  In this paper the geodesic flow on a 2-torus in a non-zero magnetic field is
considered. Suppose that this flow admits an additional first integral $F$ on
$N+2$ different energy levels which is polynomial in momenta of arbitrary
degree $N$ with analytic periodic coefficients. It is proved that in this case
the magnetic field and metrics are functions of one variable and there exists a
linear in momenta first integral on all energy levels.
