#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int n,k,a[20],f[10010],ans,print[20];
const int inf = 0x7ffffff;
void gengxin()
{
int i = 1;
f[1] = 1;
while (1)
{
f[i] = inf;
for (int j = 1; j <= k && i - a[j] >= 0; j++)
f[i] = min(f[i],f[i - a[j]] + 1);
if (f[i] > n)
break;
i++;
}
i--;
if (i > ans)
{
ans = i;
for (int j = 1; j <= k; j++)
print[j] = a[j];
}
}
void dfs(int depth,int minn)
{
if (depth > k)
{
gengxin();
return;
}
for (int i = minn + 1; i <= minn * n + 1; i++)
{
a[depth] = i;
dfs(depth + 1,i);
a[depth] = 0;
}
}
int main()
{
scanf("%d%d",&n,&k);
a[1] = 1;
dfs(2,1);
for (int i = 1; i <= k; i++)
printf("%d ",print[i]);
printf("\n");
printf("MAX=%d",ans);
return 0;
}