On the existence of global first integrals in the plane