Construction of the second constant of motion for two‐dimensional classical systems