Higher Order Variational Integrators: a polynomial approach