/*#include<stdio.h>
int main()
{
int a, b, x, y, z, k, i, j;
int arr1[200][200] = {}, arr2[200][200] = {};
int c, d;
scanf("%d %d", &a, &b);
scanf("%d %d %d", &x, &y, &z);
for(i=1; i<=a; i++)
{
for(j=1; j<=b; j++)
{
scanf("%d", &arr1[i][j]);
}
}
scanf("%d", &k);
for(d=0; d<k; d++)
{
for(i=1; i<=a; i++)
{
for(j=1; j<=b; j++)
{
c = arr1[i+1][j+1] + arr1[i+1][j] + arr1[i][j+1] + arr1[i+1][j-1] + arr1[i-1][j+1] + arr1[i-1][j-1] + arr1[i-1][j] + arr1[i][j-1];
if(arr1[i][j]==1)
{
if(c>=z) arr2[i][j]=0;
else if(c>=y) arr2[i][j]=1;
}
else if(arr1[i][j]==0)
{
if(c == x)
arr2[i][j]=1;
else
arr2[i][j]=0;
}
}
}
for(i=1; i<=a; i++)
{
for(j=1; j<=b; j++)
{
arr1[i][j] = arr2[i][j];
arr2[i][j] = 0;
}
}
}
for(i=1; i<=a; i++)
{
for(j=1; j<=b; j++)
{
printf("%d ", arr1[i][j]);
}
printf("\n");
}
}*/
/*#include<stdio.h>
int main()
{
int i, j, n, data1 = 0, data2 = 1001;
int arr[1001];
scanf("%d", &n);
for(i=0; i<n; i++)
scanf("%d", &arr[i]);
for(i=0; i<n; i++)
{
if(data1 < arr[i])
data1 = arr[i];
if(data2 > arr[i])
data2 = arr[i];
}
printf("%d", data1-data2);
}*/
/*#include<stdio.h>
int main()
{
int i, j, n, k, s, y, a = 0;
int arr[10] = {};
scanf("%d %d", &n, &k);
for(i=0; i<n; i++)
{
scanf("%d %d", &s, &y);
if(y==1||y==2) arr[0]++;
else if(y==3||y==4) arr[1+s]++;
else if(y==5||y==6) arr[3+s]++;
}
for(i=0; i<5; i++)
{
if(arr[i]>0&&arr[i]%k!=0)
a += arr[i]/k+1;
else if(arr[i]>0&&arr[i]%k==0)
a += arr[i]/k;
}
printf("%d", a);
}*/
/*#include<stdio.h>
int main()
{
int k, n, a = 0, i, j, b = 0, c = 0, d = 2;
scanf("%d %d", &n, &k);
for(i=0; i<n-1; i++)
d *= 2;
for(i=1; i<=d; i++)
{
a = i;
b = 0;
for(j=1; j<=n; j++)
{
if(a%2==1)
b++;
a = a/2;
}
if(b==k)
c++;
}
printf("%d", c);
}*/
#include<stdio.h>
int main()
{
int k, n, a = 0, i, j, b = 0, c = 0, d = 2, e = 0;
scanf("%d %d", &n, &k);
for(i=0; i<n-1; i++)
d *= 2;
for(i=1; i<=d; i++)
{
a = i;
b = 0;
for(j=1; j<=n; j++)
{
if(a%2==1)
{
if(e==0)
{
printf("1 ");
b++;
}
else
{
printf("2 ");
b = 99;
}
e=2;
}
else
printf("0 ");
if(e!=0)
{
e--;
}
a = a/2;
}
printf("\n");
if(b==k)
c++;
}
printf("%d", c);
}



