In the M305 command, the P parameter refers to the heater number that is being controlled, e.g. heater 0 = bed heater, heater 1 = E0 heater etc. The X parameter in the command is the sensor channel you want to use to control that heater. If you use the configurator, it will generate the M305 commands for you.
The fault light can mean a few things:
Thermocouple is not connected
Thermocouple is shorted to something else. The thermocouple junction must be insulated from the hot end.