  The two-loop Feynman diagram contribution to the four-graviton amplitude of
eleven-dimensional supergravity compactified on a two-torus, T^2, is analyzed
in detail. The Schwinger parameter integrations are re-expressed as integration
over the moduli space of a second torus, \hat T^2, which enables the leading
low-momentum contribution to be evaluated in terms of maps of \hat T^2 into
T^2. The ultraviolet divergences associated with boundaries of moduli space are
regularized in a manner that is consistent with the expected duality symmetries
of string theory. This leads to an exact expression for terms of order D^4 R^4
in the effective M theory action (where R^4 denotes a contraction of four Weyl
tensors), thereby extending earlier results for the R^4 term that were based on
the one-loop eleven-dimensional amplitude. Precise agreement is found with
terms in type IIA and IIB superstring theory that arise from the low energy
expansion of the tree-level and one-loop string amplitudes and predictions are
made for the coefficients of certain two-loop string theory terms as well as
for an infinite set of D-instanton contributions. The contribution at the next
order in the derivative expansion, D^6 R^4, is problematic, which may indicate
that it mixes with higher-loop effects in eleven-dimensional supergravity.
