#include <stdio.h>
int main()
{
int arr[101][101]={};
int n,m,i,j,k=1;
int size,turn=1,nn,mm;
scanf("%d %d",&n,&m);
size=n*m;nn=n;mm=m;
i=1;j=1;
while(1)
{
i=turn; j=turn;
while(j<=mm-1) //right
{
arr[i][j++]=k++;
if(k>size) break;
}
while(i<=nn-1) // down
{
arr[i++][j]=k++;
if(k>size) break;
}
while(j>turn) //left
{
arr[i][j--]=k++;
if(k>size) break;
}
while(i>turn) //up
{
arr[i][j]=k++;
if(i==turn-1||k>size) break;
i--;
}
nn=nn-1;
mm=mm-1;
turn++;
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
printf("%d ",arr[i][j]);
}
printf("\n");
}
}