We consider periodic arrays of M2-branes in the ABJM model in the spirit of a circle compactification to D2-branes in type IIA string theory. The result is a curious formulation of three-dimensional maximally supersymmetric Yang-Mills theory in terms of fermions, seven transverse scalars, a non-dynamical gauge field and an additional scalar `dual gluon. Upon further T-duality on a transverse torus we obtain a non-manifest-Lorentz-invariant description of five-dimensional maximally supersymmetric Yang-Mills. Here the additional scalar field can be thought of as the components of a two-form along the torus. This action can be viewed as an M-theory description of M5-branes on ${mathbb T}^3$.