\documentclass[tikz,border=3.14mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) grid[step=2cm] (6,8);
\foreach \X [count=\x] in {0,...,3}
{\foreach \Y [count=\y] in {0,...,4}
{
\ifnum\Y=0
\node[anchor=north west] (X-\X-\Y) at (2*\X,2*\Y) {\y,\x};
\else
\ifnum\X=0
\node[anchor=south east] (X-\X-\Y) at (2*\X,2*\Y) {\y,\x};
\else
\node[anchor=south west] (X-\X-\Y) at (2*\X,2*\Y) {\y,\x};
\fi
\fi
}
}
\path (X-3-2.east) -- (X-3-3.east) node[midway,right=2pt]{$m_y=5$};
\path (X-1-0.south) -- (X-2-0.south) node[midway,below=2pt]{$m_x=4$};
\end{tikzpicture}
\end{document}