First integrals of affine connections and