Nonlocal constants of motion in Lagrangian Dynamics of any order