The SureFire MasterFire Weaponlight is too large to properly fit on the smaller accessory rail of the P365 X-Macro Comp. I would recommend a smaller light/laser combo such as the Streamlight TLR-8 or SureFire XC2-B Compact Pistol Light. Both options can be found linked below:
https://www.opticsplanet.com/streamlight-tlr-8-a.html
https://www.opticsplanet.com/surefire-xc2-b-compact-pistol-light-w-laser.html