#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;

int a[105][105];

int main() {
    ios_base::sync_with_stdio(0);
   // freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    int n,k;
    cin >> n >> k;
    if (k > n * n || (k > n && k % 2 == 1) ) {
        cout << -1 << endl;
        return 0;
    }
    for (int i=0; i<n/2; i++) {
        if (k <= 0) break;
        a[i][i]=1;
        k--;
    }
    if (k == 1) {
      for (int i = 0 ; i<n; i++) {
            if (a[i][i] == 0) {
                a[i][i] = 1;
                break;
            }
        }
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
        return 0;
    }
    if (k == -1 ) {
        for (int i = n -1 ; i>=0; i--) {
            if (a[i][i] == 1) {
                a[i][i] = 0;
                break;
            }
        }
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
        return 0;
    }
    if (k == 0) {
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                cout << a[i][j] << " ";
            }
            cout << endl;
        }
        return 0;
    }
    for (int i=0; i<n; i++) {
        int f = 0;
        for (int j=0; j<n; j++) {
            if (k <= 0) {
                if (k == 0) f = 1;
                else f = 2;
                break;
            }
            if (a[i][j] == 1) continue;
            a[i][j] = 1;
            a[n-i][n-j]=1;
            if (i == n-i && j == n - j) k--;
              else k-=2;
        }
        if (f == 2) {
            cout << -1 << endl;
            return 0;
        }
        if (f == 1) break;
    }
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
}


#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;

int a[105][105];

int main() {
    ios_base::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
   // freopen("output.txt", "w", stdout);
    int n,k;
    cin >> n >> k;
    if (k > n * n ) {
        cout << -1 << endl;
        return 0;
    }
    for (int i=0; i<n; i++) {
        int f = 0;
        for (int j=0; j<n; j++) {
            if (k <= 1) {
                f = 1;
                break;
            }
            if (i == j) k--;
            else k-=2;
            a[i][j] = 1;
            if (i != j) a[n-i-1][n-j-1]=1;
        }
        if (f == 1) break;
    }
    if (k == 1) {
        for (int i=0; i<n; i++) {
            if (a[i][i] == 0) {
                a[i][i] = 1;
                break;
            }
        }
    }
    if (k == -1) {
        for (int i=n-1; i>=0; i--) {
            if (a[i][i] == 1) {
                a[i][i] = 0;
                break;
            }
        }
    }
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
}


#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;

int a[105][105];

int main() {
    ios_base::sync_with_stdio(0);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int n,k;
    cin >> n >> k;
    if (k > n * n ) {
        cout << -1 << endl;
        return 0;
    }
    for (int i=0; i<n; i++) {
        int f = 0;
        for (int j=0; j<n; j++) {
            if (k <= 1) {
                f = 1;
                break;
            }
            if (i == j) k--;
            else k-=2;
            a[i][j] = 1;
            if (i != j) a[j][i]=1;
        }
        if (f == 1) break;
    }
    if (k == 1) {
        for (int i=0; i<n; i++) {
            if (a[i][i] == 0) {
                a[i][i] = 1;
                break;
            }
        }
    }
    if (k == -1) {
        for (int i=n-1; i>=0; i--) {
            if (a[i][i] == 1) {
                a[i][i] = 0;
                break;
            }
        }
    }
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            cout << a[i][j] << " ";
        }
        cout << endl;
    }
}


#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <cmath>
#include <ctype.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <time.h>
using namespace std;

#define ls o<<1
#define rs o<<1|1
#define ll long long
#define PI acos(-1.0)
#define MS(x, y) memset(x, y, sizeof(x))
const int N = 1e5 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f;

int n,m,i,j,k,t;
char ch; string s;
//int f[N][N];
int gcd(int x, int y)
{
    return y == 0 ? x : gcd(y, x % y);
}

int x;
const int MAXN = 5e4 + 1;
int a[MAXN], b[MAXN], f[MAXN], c[200][200];

 int main() {
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     while(cin >> n >> k)
     {
         MS(c, 0);
         if(k > n*n)  {  cout << "-1" << endl;  return 0;  }
         else //if(k > n)
         {
             for(i=1; i<=n; i++)
             {
                 if(k==0) break;
                 for(j=1;j<=n;j++)
                 {
                     if(k==0) break;
                     if(i==j) { c[i][j] = 1; k--; }
                     else  {
                         if(k==1) continue;
                         c[i][j] = 1;
                         c[j][i] = 1;
                         k -= 2;
                     }
                 }
             }

         }
       /*  else {
             for(i=1; i<=k; i++) c[i][i] = 1;
         } */
         for(i=1; i<=n; i++)
         {
             for(j=1; j<=n; j++)
             {
                 if(j==1) cout << c[i][j];
                 else cout << ' ' << c[i][j];
             }
             cout << endl;
         }
     }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <cmath>
#include <ctype.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <time.h>
using namespace std;

#define ls o<<1
#define rs o<<1|1
#define ll long long
#define PI acos(-1.0)
#define MS(x, y) memset(x, y, sizeof(x))
const int N = 1e5 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f;

int n,m,i,j,k,t;
char ch; string s;
//int f[N][N];
int gcd(int x, int y)
{
    return y == 0 ? x : gcd(y, x % y);
}

int x;
const int MAXN = 5e4 + 1;
int a[MAXN], b[MAXN], f[MAXN], c[200][200];

 int main() {
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     while(cin >> n >> k)
     {
         MS(c, 0);
         if(k > n*n)  {  cout << "-1" << endl;  return 0;  }
         else //if(k > n)
         {
             for(i=1; i<=n; i++)
             {

                 for(j=1;j<=n;j++)
                 {
                     if(k==0) break;
                     if(i==j) { c[i][j] = 1; k--; }
                     else  {
                         if(k==1) continue;
                         if(c[i][j] == 0)
                         {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         k -= 2;
                         }
                     }
                    // cout << i << ' ' << j << ' ' << k << endl;
                 }
                 if(k==0) break;
             }

         }
       /*  else {
             for(i=1; i<=k; i++) c[i][i] = 1;
         } */
         for(i=1; i<=n; i++)
         {
             for(j=1; j<=n; j++)
             {
                 if(j==1) cout << c[i][j];
                 else cout << ' ' << c[i][j];
             }
             cout << endl;
         }
     }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <cmath>
#include <ctype.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <time.h>
using namespace std;

#define ls o<<1
#define rs o<<1|1
#define ll long long
#define PI acos(-1.0)
#define MS(x, y) memset(x, y, sizeof(x))
const int N = 1e5 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f;

int n,m,i,j,k,t;
char ch; string s;
//int f[N][N];
int gcd(int x, int y)
{
    return y == 0 ? x : gcd(y, x % y);
}

int x;
const int MAXN = 5e4 + 1;
int a[MAXN], b[MAXN], f[MAXN], c[200][200];

 int main() {
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     while(cin >> n >> k)
     {
         MS(c, 0);
         if(k > n*n)  {  cout << "-1" << endl;  return 0;  }
         else if(k > n)
         {
             for(i=1; i<=n; i++)
             {
                 c[i][i] = 1;
             }
             int p = k-n;
             if(p%2==0)
             {
                 for(i=1; i<=n; i++)
                 {
                     if(p==0) break;
                     for(j=i+1; j<=n; j++)
                     {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         p -= 2;
                         if(p==0) break;
                     }
                 }
             }
             else {
                 p++; c[n][n]=0;
                 for(i=1; i<=n; i++)
                 {
                     if(p==0) break;
                     for(j=i+1; j<=n; j++)
                     {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         p -= 2;
                        // cout << i << ' ' << j << ' ' << p << endl;
                         if(p<=0)  break;
                     }

                 }
             }
         }
         else {
             for(i=1; i<=k; i++) c[i][i] = 1;
         }
         for(i=1; i<=n; i++)
         {
             for(j=1; j<=n; j++)
             {
                 if(j==1) cout << c[i][j];
                 else cout << ' ' << c[i][j];
             }
             cout << endl;
         }
     }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <cmath>
#include <ctype.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <time.h>
using namespace std;

#define ls o<<1
#define rs o<<1|1
#define ll long long
#define PI acos(-1.0)
#define MS(x, y) memset(x, y, sizeof(x))
const int N = 1e5 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f;

int n,m,i,j,k,t;
char ch; string s;
//int f[N][N];
int gcd(int x, int y)
{
    return y == 0 ? x : gcd(y, x % y);
}

int x;
const int MAXN = 5e4 + 1;
int a[MAXN], b[MAXN], f[MAXN], c[200][200];

 int main() {
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     while(cin >> n >> k)
     {
         MS(c, 0);
         if(k > n*n)  {  cout << "-1" << endl;  return 0;  }
         else if(k > n)
         {
             for(i=1; i<=n; i++)
             {
                 c[i][i] = 1;
             }
             int p = k-n;
             if(p%2==0)
             {
                 for(i=1; i<=n; i++)
                 {
                     for(j=i+1; j<=n; j++)
                     {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         p -= 2;
                         if(p==0) break;
                     }
                 }
             }
             else {
                 p++; c[n][n]=0;
                 for(i=1; i<=n; i++)
                 {
                     if(p==0) break;
                     for(j=i+1; j<=n; j++)
                     {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         p -= 2;
                        // cout << i << ' ' << j << ' ' << p << endl;
                         if(p<=0)  break;
                     }

                 }
             }
         }
         else {
             for(i=1; i<=k; i++) c[i][i] = 1;
         }
         for(i=1; i<=n; i++)
         {
             for(j=1; j<=n; j++)
             {
                 if(j==1) cout << c[i][j];
                 else cout << ' ' << c[i][j];
             }
             cout << endl;
         }
     }
    return 0;
}


#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <cstdio>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <cmath>
#include <ctype.h>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <bitset>
#include <time.h>
using namespace std;

#define ls o<<1
#define rs o<<1|1
#define ll long long
#define PI acos(-1.0)
#define MS(x, y) memset(x, y, sizeof(x))
const int N = 1e5 + 10, MOD = 1e9 + 7, inf = 0x3f3f3f3f;

int n,m,i,j,k,t;
char ch; string s;
//int f[N][N];
int gcd(int x, int y)
{
    return y == 0 ? x : gcd(y, x % y);
}

int x;
const int MAXN = 5e4 + 1;
int a[MAXN], b[MAXN], f[MAXN], c[200][200];

 int main() {
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);
     while(cin >> n >> k)
     {
         MS(c, 0);
         if(k > n*n)  {  cout << "-1" << endl;  return 0;  }
         else if(k > n)
         {
             for(i=1; i<=n; i++)
             {
                 c[i][i] = 1;
             }
             int p = k-n;
             if(p%2==0)
             {
                 for(i=1; i<=n; i++)
                 {
                     for(j=i+1; j<=n; j++)
                     {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         p -= 2;
                         if(p==0) break;
                     }
                 }
             }
             else {
                 p++; c[n][n]=0;
                 for(i=1; i<=n; i++)
                 {
                     for(j=i+1; j<=n; j++)
                     {
                         c[i][j] = 1;
                         c[j][i] = 1;
                         p -= 2;
                         if(p==0) break;
                     }
                 }
             }
         }
         else {
             for(i=1; i<=k; i++) c[i][i] = 1;
         }
         for(i=1; i<=n; i++)
         {
             for(j=1; j<=n; j++)
             {
                 if(j==1) cout << c[i][j];
                 else cout << ' ' << c[i][j];
             }
             cout << endl;
         }
     }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	cin>>n>>k;
	if(k>n) cout<<-1<<endl;
	else{
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(i==j && k){
					cout<<1;
					k--;
				}else cout<<0;
				if(j!=n) cout<<" ";
			}
			puts("");
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mat[123][123];
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	while(cin>>n>>k){
		memset(mat,0,sizeof mat);
		for(int i=1;i<=n&&k;i++){
			mat[i][i]=1;
			k--;
			for(int j=i+1;j<=n&&k>1;j++){
				mat[i][j]=mat[j][i]=1;
				k-=2;
			}
		}
		if(k) puts("-1");
		else{
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++)
					cout<<mat[i][j]<<' ';
				cout<<endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mat[123][123];
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	while(cin>>n>>k){
		if(k>n*n || ((k-n)&1 && k>n)) cout<<-1<<endl;
		else{
			memset(mat,0,sizeof mat);
			for(int i=1;i<=n&&k;i++,k--) mat[i][i]=1;
			for(int i=1;i<=n&&k;i++){
				for(int j=i+1;j<=n&&k;j++){
					mat[i][j]=mat[j][i]=1;
					k-=2;
				}
			}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++){
					if(j!=1) cout<<" ";
					cout<<mat[i][j];
				}
				cout<<endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mat[123][123];
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	while(cin>>n>>k){
		if(k>n*n || ((k-n)&1 && k>n)) cout<<-1<<endl;
		else{
			memset(mat,0,sizeof mat);
			for(int i=1;i<=n;i++){
				if(!k) break;
				mat[i][i]=1;
				k--;
			}
			for(int i=1;i<=n;i++){
				for(int j=i+1;j<=n;j++){
					if(!k) break;
					mat[i][j]=mat[j][i]=1;
					k-=2;
				}
			}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++)
					cout<<mat[i][j]<<' ';
				cout<<endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mat[123][123];
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	while(cin>>n>>k){
		if(k>n*n || ((k-n)&1 && k>n)) cout<<-1<<endl;
		else{
			memset(mat,0,sizeof mat);
			for(int i=1;i<=n&&k;i++){
				mat[i][i]=1;
				k--;
				for(int j=i+1;j<=n&&k>1;j++){
					mat[i][j]=mat[j][i];
					k-=2;
				}
			}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++)
					cout<<mat[i][j]<<' ';
				cout<<endl;
			}
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mat[123][123];
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	cin>>n>>k;
	if(k>n*n || ((k-n)&1 && k>n)) cout<<-1<<endl;
	else{
		for(int i=1;i<=n&&k;i++,k--) mat[i][i]=1;
		for(int i=1;i<=n&&k;i++){
			for(int j=1;j<i&&k;j++){
				mat[i][j]=mat[j][i]=1;
				k-=2;
			}
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				if(j!=1) cout<<" ";
				cout<<mat[i][j];
			}
			cout<<endl;
		}
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int mat[123][123];
int main(){
//	ios::sync_with_stdio(0);
//	cin.tie(0);
	int n,k;
	while(cin>>n>>k){
		if(k>n*n || ((k-n)&1 && k>n)) cout<<-1<<endl;
		else{
			memset(mat,0,sizeof mat);
			for(int i=1;i<=n&&k;i++){
				mat[i][i]=1;
				k--;
				for(int j=i+1;j<=n&&k>1;j++){
					mat[i][j]=mat[j][i]=1;
					k-=2;
				}
			}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=n;j++)
					cout<<mat[i][j]<<' ';
				cout<<endl;
			}
		}
	}
	return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int x,y,sum=0;
    cin>>x>>y;
    int n[x][x];
    for(int i=0;i<x;i++)
    {
        for(int j=0;j<x;j++)
        {
            if(sum<y){
                cout<<1<<" ";
                sum+=1;
            }
            else
                cout<<0<<" ";
        }
    cout<<endl;
    }

    return 0;
}


#include <iostream>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<bits/stdc++.h>
#include<cmath>
#include<algorithm>
#include<fstream>
using namespace std;
#define IO     ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main()
{
int n,m;
cin>>n>>m;
if(m>n*n){
    cout<<"-1";
    return 0;
}
char ch[1000][1000];

for(int i=0;i<n;i++)
{
    for(int j=0;j<n;j++)
    {
        ch[i][j]='0';
    }
}

if(m>0){
    m--;
    ch[0][0]='1';
}

//int k=0;
for(int i=0;i<n;i++)
{
    for(int j=i;j<n;j++)
    {
        if(i==j&&m>0&&ch[i][j]=='0'){
            ch[i][j]='1';
           //cout<<1<<endl;
            m--;
        }
        else if(m>1&&i!=j){
            //cout<<2<<endl;
            ch[i][j]='1';
            ch[j][i]='1';
            m-=2;
        }
    }
}
//cout<<m;

for(int i=0;i<n;i++)
{
    for(int j=0;j<n;j++){
        cout<<ch[i][j]<<" ";
    }
    cout<<endl;
}

return 0;
}


#include <iostream>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<bits/stdc++.h>
#include<cmath>
#include<algorithm>
#include<fstream>
using namespace std;
#define IO     ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

int main()
{
int n,m;
cin>>n>>m;
if(m>n*n){
    cout<<"-1";
    return 0;
}
char ch[1000][1000];
for(int i=0;i<n;i++)
{
    for(int j=0;j<n;j++)
    {
        ch[i][j]='0';
    }
}
if(m>0){
    m--;
    ch[0][0]='1';
}
int k=0;
while(m>0){
k++;
for(int i=0;i<n;i++)
{
    for(int j=0;j<n;j++)
    {
        if(i+j==k){
            ch[i][j]='1';
            m--;
        }
    }
}
}
for(int i=0;i<n;i++)
{
    for(int j=0;j<n;j++){
        cout<<ch[i][j]<<" ";
    }
    cout<<endl;
}

return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int x,y,sum=0;
    cin>>x>>y;
    int n[x][x];
    if(y>x){
        cout<<-1;
    }
    else{
    for(int i=0;i<x;i++)
    {
        for(int j=0;j<x;j++)
        {
            if(sum<y&&i==j){
                cout<<1<<" ";
                sum+=1;
            }
            else
                cout<<0<<" ";
        }
    cout<<endl;
    }
    }
    return 0;
}


#include <iostream>

using namespace std;

int main()
{
    int x,y,sum=0;
    cin>>x>>y;
    int n[x][x];
    for(int i=0;i<x;i++)
    {
        for(int j=0;j<x;j++)
        {
            if(sum<y&&i==j){
                cout<<1<<" ";
                sum+=1;
            }
            else
                cout<<0<<" ";
        }
    cout<<endl;
    }

    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long llu;

using namespace std;

int main() {
    FIO
    int n,k;
    cin>>n>>k;
    if(k > (n*n) || (k>n && (k-n)%2))
    {
        cout<<-1;
        return 0;
    }
    vector< vector<int> > mat(n, vector<int>(n,0));
    for(int i=0; i<n && k; i++)
    {
        mat[i][i] = 1;
        k--;
    }
    if(k>0)
    {
        for(int i=0; i<n; i++)
        {
            for(int j=0; j<n; j++)
            {
                if(mat[i][j])
                    continue;
                mat[i][j] = 1;
                mat[j][i] = 1;
                k -= 2;
                if(!k)
                    break;
            }
            if(!k)
                break;
        }
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long llu;

using namespace std;

int main() {
    FIO
    int n,k;
    cin>>n>>k;
    if(k > (n*n) || (k>n && (k-n)%2))
    {
        cout<<-1;
        return 0;
    }
    vector< vector<int> > mat(n, vector<int>(n,0));
    for(int i=0; i<n && k; i++)
    {
        mat[i][i] = 1;
        k--;
    }
    if(k>0)
    {
        int half = k/2;
        for(int j=1; j<n; j++)
        {
            for(int i=0; i<j; i++)
            {
                mat[i][j] = 1;
                k--;
                if(k == half)
                    break;
            }
            if(k == half)
                    break;
        }
        for(int i=1; i<n; i++)
        {
            for(int j=0; j<i; j++)
            {
                mat[i][j] = 1;
                k--;
                if(k == 0)
                    break;
            }
            if(k == 0)
                break;
        }
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long llu;

using namespace std;

int main() {
    FIO
    int n,k;
    cin>>n>>k;
    if(k > (n*n) || (k>n && (k-n)%2))
    {
        cout<<-1;
        return 0;
    }
    vector< vector<int> > mat(n, vector<int>(n,0));
    for(int i=0; i<n && k; i++)
    {
        mat[i][i] = 1;
        k--;
    }
    if(k>0)
    {
        int half = k/2;
        for(int i=1; i<n && k>=half; i++)
        {
            for(int j=0; j<i && k>half; j++)
            {
                mat[i][j] = 1;
                k--;
            }
        }
        for(int j=1; j<n && k; j++)
        {
            for(int i=0; i<j && k; i++)
            {
                mat[i][j] = 1;
                k--;
            }
        }
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long llu;

using namespace std;

int main() {
    FIO
    int n,k;
    cin>>n>>k;
    if(k > (n*n) || (k>n && (k-n)%2))
    {
        cout<<-1;
        return 0;
    }
    vector< vector<int> > mat(n, vector<int>(n,0));
    for(int i=0; i<n && k; i++)
    {
        mat[i][i] = 1;
        k--;
    }
    if(k>0)
    {
        int half = k/2;
        cerr<<k<<" "<<half<<endl;
        for(int i=1; i<n && k>=half; i++)
        {
            for(int j=0; j<i && k>half; j++)
            {
                mat[i][j] = 1;
                k--;
            }
        }
        for(int j=1; j<n && k; j++)
        {
            for(int i=0; i<j && k; i++)
            {
                mat[i][j] = 1;
                k--;
            }
        }
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cout<<mat[i][j];
        cout<<endl;
    }
	return 0;
}


#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long llu;

using namespace std;

int main() {
    FIO
    int n,k;
    cin>>n>>k;
    if(k > (n*n) || (k>n && (k-n)%2))
    {
        cout<<-1;
        return 0;
    }
    vector< vector<int> > mat(n, vector<int>(n,0));
    for(int i=0; i<n && k; i++)
    {
        mat[i][i] = 1;
        k--;
    }
    if(k>0)
    {
        for(int i=1; i<n; i++)
        {
            for(int j=0; j<i; j++)
            {
                mat[i][j] = 1;
                mat[j][i] = 1;
                k-=2;
                if(k == 0)
                    break;
            }
            if(k == 0)
                    break;
        }
    }
    for(int i=0; i<n; i++)
    {
        for(int j=0; j<n; j++)
            cout<<mat[i][j]<<" ";
        cout<<endl;
    }
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

int main()
{
	vector <vector<char>> vec;
	int n, k;
	cin >> n >> k;
	vec.resize(n);
	for (int i = 0; i < n; ++i) {
		vec[i].resize(n);
	}

	int i = 0, j = 0;
	while (k) {
		if (vec[i][j] || vec[j][i]) {
			if (++i >= n) {
				i = 0;
				if (++j >= n) {
					break;
				}
			}
			continue;
		}
		if (i != j && k >= 2) {
			vec[i][j] = vec[j][i] = 1;
			k -= 2;
		}
		else if (i == j) {
			vec[i][j] = 1;
			--k;
		}
		else {
			if (++i >= n) {
				i = 0;
				if (++j >= n) {
					break;
				}
			}
		}
	}

	if (k) {
		cout << "-1";
		return 0;
	}

	for (i = 0; i < n; ++i) {
		for (j = 0; j < n; ++j) {
			cout << static_cast<char>(vec[i][j] + '0') << " ";
		}
		cout << endl;
	}

	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define All(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (m > n) return cout << -1, 0;
	rep(i, n){
		rep(j, n) {
		if (i == j && m)
		{
			cout << 1 << ' ';
			m--;
		}
		else cout << 0<< ' ';}
		cout << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;
int a[111][111] = { 0 };
int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (m > n*n) return cout << -1, 0;
	rep(i, n){
		rep(j, n){
			if (i == j && m) {
				a[i][j] = 1;
				--m;
			}
			else if(i !=j && m > 1){
				a[i][j] = a[j][i] = 1;
				m -= 2;
			}
		}
	}
	rep(i, n) {
		rep(j, n){
			cout << a[i][j] << ' ';
		}cout << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define All(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (m > n) return cout << -1, 0;
	if (m == 0) return cout << -1, 0;
	rep(i, n){
		rep(j, n) {
			if (i == j && m)
			{
				cout << 1 << ' ';
				m--;
			}
			else cout << 0 << ' ';
		}
		cout << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define All(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (m >= n) return cout << -1, 0;
	rep(i, n){
		rep(j, n) {
			if (i == j && m)
			{
				cout << 1 << ' ';
				m--;
			}
			else cout << 0 << ' ';
		}
		cout << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define all(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;
int a[111][111] = { 0 };
int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (m > n*n) return cout << -1, 0;
	rep(i, n){
		rep(j, n){
			if (a[i][j] == 1) continue;
			if (i == j && m) {
				a[i][j] = 1;
				--m;
			}
			else if(i !=j && m > 1){
				a[i][j] = a[j][i] = 1;
				m -= 2;
			}
		}
	}
	rep(i, n) {
		rep(j, n){
			cout << a[i][j] << ' ';
		}cout << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define All(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (n == 1) return cout << -1, 0;
	if (m > n) return cout << -1, 0;
	rep(i, n){
		rep(j, n) {
			if (i == j && m)
			{
				cout << 1 << ' ';
				m--;
			}
			else cout << 0 << ' ';
		}
		cout << endl;
	}
	return 0;
}


#define  _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cstdio>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <cmath>
#include <bitset>
#include <iomanip>
using namespace std;
#define clr(a) memset(a, 0, sizeof(a))
#define mem(a, b) memset(a, b, sizeof(a))
#define fastIO ios::sync_with_stdio(false)
#define rep(i,n) for(int i=0;i<n;i++)
#define mp make_pair
#define All(a) a.begin(),a.end()
#define sqr (x) (x * x)
#define ang(a, b, c) acos((sqr(b)+sqr(c)-sqr(a))/(2.0*b*c))
#define dist(x1, y1, x2, y2) sqrt(sqr(x1-x2)+sqr(y1-y2))
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
#define PI 3.1415926535897932385
#define INF 1000000000
#define eps 1e-7
#define MOD 1000000007
#define maxN 111

ll n, m;

int main(){
#ifndef ONLINE_JUDGE
	freopen("in.in", "r", stdin);
	freopen("out.out", "w", stdout);
#endif
	fastIO;
	cin >> n >> m;
	if (m > 4) return cout << -1, 0;
	rep(i, n){
		rep(j, n) {
		if (i == j && m)
		{
			cout << 1 << ' ';
			m--;
		}
		else cout << 0<< ' ';}
		cout << endl;
	}
	return 0;
}


/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005
ll a[102][102];
int main()
{
	ios
	ll n,k,i,j;
	cin>>n>>k;
	if(k>n*n){
		cout<<"-1";return 0;
	}
	ll cnt=k;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(j<i)a[i][j]=a[j][i];
			else
			if(i==j&&cnt>0){a[i][j]=1;cnt--;}
			else
			if(j>i){
				if(cnt>=2)a[i][j]=1,cnt-=2;
			}
		}
	}
	//if(cnt>0){cout<<"-1";return 0;}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<"\n";
	}
	return 0;
}


/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005
ll a[102][102];
int main()
{
	ios
	ll n,k,i,j;
	cin>>n>>k;
	if(k>n*n){
		cout<<"-1";return 0;
	}
	ll cnt=k;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(j<i)a[i][j]=a[j][i];
			else
			if(i==j&&cnt>0){a[i][j]=1;cnt--;}
			else
			if(j>i){
				if(cnt>=2)a[i][j]=1,cnt-=2;
			}
		}
	}
	if(cnt>0){cout<<"-1";return 0;}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<"\n";
	}
	return 0;
}


/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005
ll a[102][102];
int main()
{
	ios
	ll n,k,i,j;
	cin>>n>>k;
	if(k>n*n){
		cout<<"-1";return 0;
	}
	ll cnt=k;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(j<i)a[j][i]=a[i][j];
			else
			if(i==j&&cnt>0){a[i][j]=1;cnt--;}
			else{
				if(cnt>2)a[i][j]=1,cnt-=2;
			}
		}
	}
	if(cnt>0){cout<<"-1";return 0;}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<"\n";
	}
	return 0;
}


/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005
ll a[102][102];
int main()
{
	ios
	ll n,k,i,j;
	cin>>n>>k;
	if(k>n*n){
		cout<<"-1";return 0;
	}
	ll cnt=k;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(j<i)a[i][j]=a[j][i];
			else
			if(i==j&&cnt>0){a[i][j]=1;cnt--;}
			else{
				if(cnt>2)a[i][j]=1,cnt-=2;
			}
		}
	}
	if(cnt>0){cout<<"-1";return 0;}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<"\n";
	}
	return 0;
}


/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005
ll a[102][102];
int main()
{
	ios
	ll n,k,i,j;
	cin>>n>>k;
	if(k>n*n){
		cout<<"-1";return 0;
	}
	ll cnt=k;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(j<i)cout<<a[j][i]<<" ";
			else
			if(i==j&&cnt>0){cout<<"1 ";cnt--;}
			else{
				if(cnt>2)a[i][j]=1,cnt-=2;
				cout<<a[i][j]<<" ";
			}
		}
		cout<<"\n";
	}
	return 0;
}


/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005
ll a[102][102];
int main()
{
	ios
	ll n,k,i,j;
	cin>>n>>k;
	if(k>n*n){
		cout<<"-1";return 0;
	}
	ll cnt=k;
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			if(j<i)a[i][j]=a[j][i];
			else
			if(i==j&&cnt>0){a[i][j]=1;cnt--;}
			else
			if(j>i){
				if(cnt>2)a[i][j]=1,cnt-=2;
			}
		}
	}
	if(cnt>0){cout<<"-1";return 0;}
	for(i=1;i<=n;i++){
		for(j=1;j<=n;j++){
			cout<<a[i][j]<<" ";
		}
		cout<<"\n";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 1e6;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

void solve() {
	int n,k; cin>>n>>k;

	int a[n][n];

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++)
			a[i][j] = 0;
	}

	int rem = 0;
	if(k > n)
		rem = n*n - k;

	if(rem % 2 != 0 || k>n*n){
		cout<<-1; return;
	}

	for(int i = 0; i<n; i++){
		if(k) {
			a[i][i] = 1;
			k--;
		}
	}

// for(int i = 0; i<n; i++){
// 		for(int j = 0; j<n; j++){
// 			cout << a[i][j]<<" ";
// 		}
// 		cout<<"\n";
// 	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			if(k){

				//cout <<k<< " gg ";
				if(i == j) continue;
				if(a[j][i] == 1) continue;
				k-=2;
				a[j][i] = 1;
				a[i][j] = 1;
			}

		}
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}

}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 1e6;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

void solve() {
	int n,k; cin>>n>>k;

	int a[n][n];

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++)
			a[i][j] = 0;
	}

	int rem = 0;

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			if(k){

				//cout <<k<< " gg ";
				// if(i == j) continue;
				if(a[j][i] == 1) continue;
				k-=2;
				a[j][i] = 1;
				a[i][j] = 1;
			}

		}
	}

	if(k!= 0) {
		 cout<<-1;
		 return;
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}

}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 1e6;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

void solve() {
	int n,k; cin>>n>>k;

	int a[n][n];

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++)
			a[i][j] = 0;
	}

	int rem = 0;

	if(k > n*n) {
		 cout<<-1;
		 return;
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){

				//cout <<k<< " gg ";

				 if(i == j && k) {
				 	a[i][i] = 1;
				 	k--;

				 }
				else if( k >=2 ) {
					k-=2;
					a[j][i] = 1;
					a[i][j] = 1;
				}

		}
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}
}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 101;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

int a[mxN][mxN];

void solve() {
	int n,k; cin>>n>>k;

	if(k > n*n){
		cout<<-1;
	return;
	}

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			if(!a[i][j]) {
				if(i == j && k) a[i][j] =1,k--;
				else if(k >1) a[i][j]=a[j][i]=1,k-=2;
			}
		}
	}

	for(int i = 1; i<=n; i++){
		for(int j = 1; j<=n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}
}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 1e6;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

void solve() {
	int n,k; cin>>n>>k;

	int a[n][n];

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++)
			a[i][j] = 0;
	}

	int rem = 0;
	if(k > n)
		rem = n*n - k;

	if(rem % 2 != 0 || k>n*n){
		cout<<-1; return;
	}

	for(int i = 0; i<n; i++){
		if(k) {
			a[i][i] = 1;
			k--;
		}
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			if(k){
				if(i == j) continue;
				k-=2;
				a[j][i] = 1;
				a[i][j] = 1;
			}

		}
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}

}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 1e6;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

void solve() {
	int n,k; cin>>n>>k;

	int a[n][n];

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++)
			a[i][j] = 0;
	}

	int rem = 0;

	if(k > n*n) {
		 cout<<-1;
		 return;
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){

				//cout <<k<< " gg ";

				 if(i == j && k && a[i][i]) {
				 	a[i][i] = 1;
				 	k--;

				 }
				else if(a[i][j] == 0 && k >=2 ) {

					k-=2;
					a[j][i] = 1;
					a[i][j] = 1;
				}

		}
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}
}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define BOOSTMoFo ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define RFOR(a,n) for(int i = a; i< n; i++)
#define FOR(n) RFOR(0,n)
const int mxN = 1e6;
const int MOD = 1e9+7;
int one= 0;

int ceil1(int a,int b){
	if(a%b == 0) return (a/b);
	else return ((a/b) + 1);
}

void solve() {
	int n,k; cin>>n>>k;

	int a[n][n];

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++)
			a[i][j] = 0;
	}

	int rem = 0;

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			if(k){

				//cout <<k<< " gg ";
				if(a[j][i] == 1) { break; }

				 if(i == j && k) {
				 	a[i][i] = 1;
				 	k--;

				 }
				else if( k >=2 ) {
					k-=2;
					a[j][i] = 1;
					a[i][j] = 1;
				}
			}

		}
	}

	if(k!= 0) {
		 cout<<-1;
		 return;
	}

	for(int i = 0; i<n; i++){
		for(int j = 0; j<n; j++){
			cout << a[i][j]<<" ";
		}
		cout<<"\n";
	}
}

signed main() {
	BOOSTMoFo
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
    #endif

   int t=1; //cin >>t;
    while(t--) {
        one++;
       solve();
    }
    return 0;
}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
//////////////////////    Hi    ^_^  hack me if you can :P
int n,k;
int a[200][200];
int main()
{
    speed;
    cin >> n >> k;
    if (k>n*n)
    {
        cout << -1 ;
        return 0;
    }
    if (k==n*n)
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << 1 << ' ';
            cout <<endl;
        }
        return 0;
    }
    rep(i,1,n) if (k)
    {
        a[i][i]=1;
        k--;
    }
    //cout << k << endl;
    if (k&&k%2==0)
    {
        rep(i,1,n)
        {
            rep(j,i+1,n)
            {
                if (k)
                {
                    a[i][j]=1;
                    a[j][i]=1;
                    k-=2;
                }
            }
        }
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
        return 0;
    }
    else if(k)
    {
        cout << -1;
        return 0;
    }
    else
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
    }
}
/*
15 5 4
2
5
7
10
13

https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)

int n, a[N];
int seg[N<<2];

void build(int nd,int L,int R)
{
    if( L == R )
    {
        seg[nd]=a[L];
        return ;
    }
    int mid = (L+R) >>1;
    build(nd<<1,L, mid);
    build(nd<<1|1,mid+1,R);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

void update(int nd,int L,int R,int idx,int val)
{
    if( L == R )
    {
        seg[nd]=val;
        return ;
    }
    int mid = (L+R) >>1;
    if( idx<=mid )
        update(nd<<1,  L,mid,idx,val);
    else update(nd<<1|1,mid+1, R,idx,val);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

int query(int nd,int L,int R,int from,int to)
{
    if( from<=L && R<=to )return seg[nd];
    if( from>R || to<L )return -inf;

    int mid = (L+R) >>1;

    int leftAns = query(nd<<1,  L,mid,from,to);
    int rightAns= query(nd<<1|1,mid+1, R,from,to);
    return max( leftAns,rightAns );
}

*/


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
//////////////////////    Hi    ^_^  hack me if you can :P
int n, k ;
int a[200][200];
int main()
{
    speed;
    cin >> n >> k;
    for (int i=1; i<=n; i++)
    {
        for (int j=i; j<=n; j++)
        {
            if (i==j)
            {
                if(k)
                {
                    a[i][j]=1;
                    k--;
                }
            }
            else
            {

                if(k>=2)
                {
                    a[i][j]=a[j][i]=1;
                    k-=2;
                }

            }
        }
    }
    if(k==0)
    for (int i=1; i<=n; i++)
    {
        for (int j=1; j<=n; j++)
            cout << a[i][j] << ' ';
        cout << endl;
    }
    else
        cout << -1;
}
/*
15 5 4
2
5
7
10
13

https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)

int n, a[N];
int seg[N<<2];

void build(int nd,int L,int R)
{
    if( L == R )
    {
        seg[nd]=a[L];
        return ;
    }
    int mid = (L+R) >>1;
    build(nd<<1,L, mid);
    build(nd<<1|1,mid+1,R);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

void update(int nd,int L,int R,int idx,int val)
{
    if( L == R )
    {
        seg[nd]=val;
        return ;
    }
    int mid = (L+R) >>1;
    if( idx<=mid )
        update(nd<<1,  L,mid,idx,val);
    else update(nd<<1|1,mid+1, R,idx,val);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

int query(int nd,int L,int R,int from,int to)
{
    if( from<=L && R<=to )return seg[nd];
    if( from>R || to<L )return -inf;

    int mid = (L+R) >>1;

    int leftAns = query(nd<<1,  L,mid,from,to);
    int rightAns= query(nd<<1|1,mid+1, R,from,to);
    return max( leftAns,rightAns );
}

*/


#include <stdio.h>
#include <iostream>
#include <climits>
#include <map>
#include <cmath>
#include <algorithm>
#include <set>
#include <stack>
#include <deque>
#include <vector>
#include <stdlib.h>
#include <string>
#include <string.h>
#include <utility>
#include <queue>

using namespace std;

long long a[110][110];
int main()
{
    long long n, i1, j1, k, c=0, i2, j2, f, i, j;
    scanf("%lld %lld", &n, &k);

    if(k>n*n)
        puts("-1\n");
    else if(k>n && (k-n)%2==1)
        puts("-1\n");
    else
    {
        i=j=1;
        if(c<k)
        {
            while(1)
            {
                a[i][j]=1;
                c++;
                i++;
                j++;
                if(c==n || c==k)
                    break;
            }
        }
        i1=1;
        j1=2;
        i2=n;
        j2=n-1;
        f=0;
        if(c<k)
        {
            while(1)
            {
                if(f==0)
                {
                    //printf("%lld %lld\n", i1, j1);
                    a[i1][j1]=1;
                    f=1;
                    c++;
                    if(i1==j1+1)
                    {
                        j1+=2;
                    }
                    else if(j1+1>n)
                    {
                        i1++;
                        j1=1;
                    }
                    else
                    {
                        j1++;
                    }
                    //printf("%lld %lld\n", i1, j1);
                }
                else
                {
                    a[i2][j2]=1;
                    f=0;
                    c++;
                    if(i2==j2-1)
                    {
                        j2-=2;
                    }
                    else if(j2-1<1)
                    {
                        i2--;
                        j2=n;
                    }
                    else
                    {
                        j2--;
                    }
                }
                if(c==k)
                    break;
            }
        }

        for(i=1; i<=n; i++)
        {
            for(j=1; j<=n; j++)
                printf("%lld ", a[i][j]);
            printf("\n");
        }
    }
    return 0;

}


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
//////////////////////    Hi    ^_^  hack me if you can :P
int n,k;
int a[200][200];
int main()
{
    speed;
    cin >> n >> k;
    if (k>n*n)
    {
        cout << -1 ;
        return 0;
    }
    if (k==n*n)
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << 1 << ' ';
            cout <<endl;
        }
        return 0;
    }
    rep(i,1,n) if (k)
    {
        a[i][i]=1;
        k--;
    }
    //cout << k << endl;
    if (k&&k%2==0)
    {
        rep(i,1,n)
        {
            rep(j,i+1,n)
            {
                if (k)
                {
                    a[i][j]=1;
                    a[n-i+1][n-j+1]=1;
                    k-=2;
                }
            }
        }
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
        return 0;
    }
    else if(k)
    {
        cout << -1;
        return 0;
    }
    else
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
    }
}
/*
15 5 4
2
5
7
10
13

https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)

int n, a[N];
int seg[N<<2];

void build(int nd,int L,int R)
{
    if( L == R )
    {
        seg[nd]=a[L];
        return ;
    }
    int mid = (L+R) >>1;
    build(nd<<1,L, mid);
    build(nd<<1|1,mid+1,R);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

void update(int nd,int L,int R,int idx,int val)
{
    if( L == R )
    {
        seg[nd]=val;
        return ;
    }
    int mid = (L+R) >>1;
    if( idx<=mid )
        update(nd<<1,  L,mid,idx,val);
    else update(nd<<1|1,mid+1, R,idx,val);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

int query(int nd,int L,int R,int from,int to)
{
    if( from<=L && R<=to )return seg[nd];
    if( from>R || to<L )return -inf;

    int mid = (L+R) >>1;

    int leftAns = query(nd<<1,  L,mid,from,to);
    int rightAns= query(nd<<1|1,mid+1, R,from,to);
    return max( leftAns,rightAns );
}

*/


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
//////////////////////    Hi    ^_^  hack me if you can :P
int n,k;
int a[200][200];
int main()
{
    speed;
    cin >> n >> k;
    if (k>n*n)
    {
        cout << -1 ;
        return 0;
    }
    if (k==n*n)
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << 1 << ' ';
            cout <<endl;
        }
        return 0;
    }
    rep(i,1,n) if (k)
    {
        a[i][i]=1;
        k--;
    }
    //cout << k << endl;
    if (k&&k%2==0)
    {
        rep(i,1,n)
        {
            rep(j,i+1,n)
            {
                if (k)
                {
                    a[i][j]=1;
                    a[j][i]=1;
                    k--;
                }
            }
        }
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
    }
    else if(k)
    {
        cout << -1;

    }
    else
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
    }
}
/*
15 5 4
2
5
7
10
13

https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)

int n, a[N];
int seg[N<<2];

void build(int nd,int L,int R)
{
    if( L == R )
    {
        seg[nd]=a[L];
        return ;
    }
    int mid = (L+R) >>1;
    build(nd<<1,L, mid);
    build(nd<<1|1,mid+1,R);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

void update(int nd,int L,int R,int idx,int val)
{
    if( L == R )
    {
        seg[nd]=val;
        return ;
    }
    int mid = (L+R) >>1;
    if( idx<=mid )
        update(nd<<1,  L,mid,idx,val);
    else update(nd<<1|1,mid+1, R,idx,val);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

int query(int nd,int L,int R,int from,int to)
{
    if( from<=L && R<=to )return seg[nd];
    if( from>R || to<L )return -inf;

    int mid = (L+R) >>1;

    int leftAns = query(nd<<1,  L,mid,from,to);
    int rightAns= query(nd<<1|1,mid+1, R,from,to);
    return max( leftAns,rightAns );
}

*/


#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 100100;
const int inf = INT_MAX;
const double eps = 1e-7;
//////////////////////    Hi    ^_^  hack me if you can :P
int n,k;
int a[200][200];
int main()
{
    speed;
    cin >> n >> k;
    if (k>n*n)
    {
        cout << -1 ;
        return 0;
    }
    if (k==n*n)
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << 1 << ' ';
            cout <<endl;
        }
        return 0;
    }
    rep(i,1,n) if (k)
    {
        a[i][i]=1;
        k--;
    }
    //cout << k << endl;
    if (k&&k%2==0)
    {
        rep(i,1,n)
        {
            rep(j,i+1,n)
            {
                if (k)
                {
                    a[i][j]=1;
                    a[j][i]=1;
                    k-=2;
                }
            }
        }
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
    }
    else if(k)
    {
        cout << -1;

    }
    else
    {
        rep(i,1,n)
        {
            rep(j,1,n)
            cout << a[i][j] << ' ';
            cout <<endl;
        }
    }
}
/*
15 5 4
2
5
7
10
13

https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)

int n, a[N];
int seg[N<<2];

void build(int nd,int L,int R)
{
    if( L == R )
    {
        seg[nd]=a[L];
        return ;
    }
    int mid = (L+R) >>1;
    build(nd<<1,L, mid);
    build(nd<<1|1,mid+1,R);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

void update(int nd,int L,int R,int idx,int val)
{
    if( L == R )
    {
        seg[nd]=val;
        return ;
    }
    int mid = (L+R) >>1;
    if( idx<=mid )
        update(nd<<1,  L,mid,idx,val);
    else update(nd<<1|1,mid+1, R,idx,val);
    seg[nd]=max( seg[nd<<1], seg[nd<<1|1] );
}

int query(int nd,int L,int R,int from,int to)
{
    if( from<=L && R<=to )return seg[nd];
    if( from>R || to<L )return -inf;

    int mid = (L+R) >>1;

    int leftAns = query(nd<<1,  L,mid,from,to);
    int rightAns= query(nd<<1|1,mid+1, R,from,to);
    return max( leftAns,rightAns );
}

*/


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2)ans[n - 1][n - 1] = 0;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = 0; j < i && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2 && k < n * n - n)ans[n - 1][n - 1] = 0;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = 0; j < i && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2)ans[n - 1][n - 1] = 0;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = 0; j < i && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = i; j < n && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2 - (i == j);
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n; i++)
	{
		for (int j = i; j < n; j++)
		{
			if (i != j && k < 2)break;
			if (i == j && k < 1)break;
			ans[i][j] = ans[j][i] = 1;
			k -= 2 - (i == j);
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2 && k < n * n - n)ans[n - 1][n - 1] = 0;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = 0; j < i && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2)ans[n - 1][n - 1] = 0, k++;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = 0; j < i && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2)ans[n - 1][n - 1] = 0, k++;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = i + 1; j < n && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>
#include <memory.h>
#include <math.h>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstdio>
#include <bitset>

using namespace std;

#define nfs ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f first
#define s second
#define m_p make_pair
#define pb push_back
#define ii pair<int,int>
#define iii pair<int,pair<int,int> >
#define ll long long
#define ull unsigned long long
#define ld long double
#define ef else if
#define loc(x) (x).begin(),(x).end()
#define locR(x) (x).rbegin(),(x).rend()
#define no puts("NO")
#define yes puts("YES")
#define ex puts("-1")
#define en puts("")
#define _ cout
#define __ <<
#define outV(v) for(int i = 0 ; i < v.size() ; i++)cout << v[i] << ' ';
#define outA(x,l,r) for(int i = l ; i < r ; i++)cout << x[i] << ' ';

#ifndef ONLINE_JUDGE
#define scanf scanf_s
#endif

const ld EPS = 1e-18;
const double DEPS = 1e-9;
const ld PI = 3.141592653589793238;
const ll MOD = 998244353;
const int N = (int)(5e5) + 1;

void inp()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "inp.txt", "r", stdin);
#endif
}
void out()
{
#ifndef ONLINE_JUDGE
	FILE* stream;
	freopen_s(&stream, "out.txt", "w", stdout);
#endif
}

ll gcd(ll fx, ll fy)
{
	if (!fy) return fx;
	return gcd(fy, fx % fy);
}

inline void fill(int* ar, int sz, int val)
{
	for (int i = 0; i < sz; i++)
	{
		ar[i] = val;
	}
}

int n, k;
bool ans[101][101];

int main()
{
	inp();
	cin >> n >> k;
	if (k > n * n)return puts("-1"), 0;

	for (int i = 0; i < n && k; i++)
	{
		ans[i][i] = 1;
		k--;
	}

	if (k % 2)ans[n - 1][n - 1] = 0, k++;

	for (int i = 0; i < n && k; i++)
	{
		for (int j = i + 1 ; j < n && k; j++)
		{
			ans[i][j] = ans[j][i] = 1;
			k -= 2;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			printf("%d ", ans[i][j]);
		}puts("");
	}
}


#include<stdio.h>
#include<string.h>
int main()
{
    int n,m,b,g,boy[100],girl[100],x,flag,i;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
        boy[i]=0;
    for(i=0;i<m;i++)
        girl[i]=0;
    scanf("%d",&b);
    for(i=0;i<b;i++)
    {
        scanf("%d",&x);
        boy[x]=1;
    }
    scanf("%d",&g);
    for(i=0;i<g;i++)
    {
        scanf("%d",&x);
        girl[x]=1;
    }
    for(i=0;i<((n+1)*m);i++)
    {
        if((boy[i%n]==1)||(girl[i%m]==1))
          {
            boy[i%n]=1;
            girl[i%m]=1;
          }
    }
    flag=0;
    if(m>n)
    {
        for(i=0;i<m;i++)
    {
        if(girl[i]!=1)
        {
            flag=1;
            break;
        }
        if(i<n)
            if(boy[i]!=1)
        {
            flag=1;
            break;
        }
    }
    }
    else
    {
        for(i=0;i<n;i++)
    {
        if(boy[i]!=1)
        {
            flag=1;
            break;
        }
        if(i<m)
            if(girl[i]!=1)
        {
            flag=1;
            break;
        }
    }
    }
    if(flag==1)
        printf("No\n");
    else printf("Yes\n");
}


#include<stdio.h>
#include<string.h>
int main()
{
    int n,m,b,g,boy[100],girl[100],x,flag,i;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
        boy[i]=0;
    for(i=0;i<m;i++)
        girl[i]=0;
    scanf("%d",&b);
    for(i=0;i<b;i++)
    {
        scanf("%d",&x);
        boy[x]=1;
    }
    scanf("%d",&g);
    for(i=0;i<g;i++)
    {
        scanf("%d",&x);
        girl[x]=1;
    }
    for(i=0;i<(n*m);i++)
    {
        if((boy[i%n]==1)||(girl[i%m]==1))
          {
            boy[i%n]=1;
            girl[i%m]=1;
          }
    }
    flag=0;
    if(m>n)
    {
        for(i=0;i<m;i++)
    {
        if(girl[i]!=1)
        {
            flag=1;
            break;
        }
        if(i<n)
            if(boy[i]!=1)
        {
            flag=1;
            break;
        }
    }
    }
    else
    {
        for(i=0;i<n;i++)
    {
        if(boy[i]!=1)
        {
            flag=1;
            break;
        }
        if(i<m)
            if(girl[i]!=1)
        {
            flag=1;
            break;
        }
    }
    }
    if(flag==1)
        printf("No\n");
    else printf("Yes\n");
}


#include<stdio.h>
#include<string.h>
int main()
{
    int n,m,b,g,boy[100],girl[100],x,flag,i;
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
        boy[i]=0;
    for(i=0;i<m;i++)
        boy[i]=0;
    scanf("%d",&b);

    for(i=0;i<b;i++)
    {
        scanf("%d",&x);
        boy[x]=1;
    }
    scanf("%d",&g);
    //memset(girl,0,g);
    for(i=0;i<g;i++)
    {

        scanf("%d",&x);
        girl[x]=1;
    }
    for(i=0;i<n*m;i++)
    {
        if((boy[i%n]==1)||(girl[i%m]==1))
    {
            boy[i%n]=1;
            girl[i%m]=1;
    }

    }
    if(n>m)
        x=n;
    else x=m;
    flag=0;
    for(i=0;i<x;i++)
    {
        if(girl[i]!=1)
        {
            flag=1;
            break;
        }
        if(i<n)
            if(boy[i]!=1)
        {
            flag=1;
            break;
        }
    }
    if(flag==1)
        printf("No\n");
    else printf("Yes\n");
}


#include<stdio.h>
#include<conio.h>

#define SIZE 100

int top = -1;
char stack[SIZE];

void push(char item);
char pop();
int is_operator(char symbol);
int precedence(char symbol);

int main()
{
 int a[102]={0},flag1=0,flag=0,n1,c,d,m1,b[102]={0},i, j,n,m;
 scanf("%d %d",&n,&m);
 scanf("%d",&n1);
 if(n1>0)
 {for(i=0;i<n1;i++)
 {
     scanf("%d",&c);
     a[c]=1;

 }
 }
 scanf("%d",&m1);
 if(m1>0)
 {
     for(i=0;i<m1;i++)
 {
     scanf("%d",&d);
     b[d]=1;

 }
 }
 for(i=0;i<=10000;i++)
 {
     if(a[i%n]||b[i%m])
     {
         a[i%n]=1;
         b[i%m]=1;
     }
 }
 for(i=0;i<m;i++)
 {
     if(b[i]==0)
     {
         flag1=1;
         break;
     }
 }
 for(i=0;i<n;i++)
 {
     if(a[i]==0)
     {
         flag=1;
         break;
     }
 }

 if(flag==1)
    printf("NO");
 else
    printf("YES");
 return 0;
}


#include<stdio.h>
#include<conio.h>

#define SIZE 100

int top = -1;
char stack[SIZE];

void push(char item);
char pop();
int is_operator(char symbol);
int precedence(char symbol);

int main()
{
 int a[102]={0},flag=0,n1,c,d,m1,b[102]={0},i, j,n,m;
 scanf("%d %d",&n,&m);
 scanf("%d",&n1);
 if(n1>0)
 {for(i=0;i<n1;i++)
 {
     scanf("%d",&c);
     a[c]=1;

 }
 }
 scanf("%d",&m1);
 if(m1>0)
 {
     for(i=0;i<m1;i++)
 {
     scanf("%d",&d);
     b[d]=1;

 }
 }
 for(i=0;i<m*n;i++)
 {
     if(a[i%n]||b[i%m])
     {
         a[i%n]=1;
         b[i%m]=1;
     }
 }
 for(i=0;i<m;i++)
 {
     if(b[i]==0)
     {
         flag=1;
         break;
     }
 }
 for(i=0;i<n;i++)
 {
     if(a[i]==0)
     {
         flag=1;
         break;
     }
 }
 if(flag==1)
    printf("NO");
 else
    printf("YES");
 return 0;
}

void push(char item)
{
 if(top >= SIZE-1)
 {
  printf("\nStack Overflow. Push not possible.\n");
 }
 else
 {
  top = top+1;
  stack[top] = item;
 }
}

char pop()
{
 char item;
 if(top <= -1)
 {
  printf("\nStack Underflow. Pop not possible.\n");
 }
 else
 {
  item = stack[top];
  stack[top] = '0';
  top = top-1;
 }
 return(item);
}

int is_operator(char symbol)
{
 if(symbol == '^' || symbol == '*' || symbol == '/' || symbol == '+' || symbol == '-')
 {
  return 1;
 }
 else
 {
  return 0;
 }
}

int precedence(char symbol)
{
 if(symbol == '^')
 {
  return(3);
 }
 else if(symbol == '*' || symbol == '/')
 {
  return(2);
 }
 else if(symbol == '+' || symbol == '-')
 {
  return(1);
 }
 else
 {
  return(0);
 }
}


#include <stdio.h>

int bl[110];
int gl[110];

int main() {
    int n, m, b, g, i, temp;
    scanf("%d %d", &n, &m);
    scanf("%d", &b);
    for (i=0; i<b; i++) {
        scanf("%d", &temp);
        bl[temp] = 1;
    }
    scanf("%d", &g);
    for (i=0; i<g; i++) {
        scanf("%d", &temp);
        gl[temp] = 1;
    }
    i=0;
    while (b != n || g != m) {
        if (bl[i%n] || gl[i%m]) {
            bl[i%n] = 1; b++;
            gl[i%m] = 1; g++;
        }
        else if (i>10000) {
            printf("No\n");
            return 0;
        }

        i++;
    }
    printf("Yes\n");
    return 0;
}


#include <stdio.h>

int bl[110];
int gl[110];

int main() {
    int n, m, b, g, i, temp;
    scanf("%d %d", &n, &m);
    scanf("%d", &b);
    for (i=0; i<b; i++) {
        scanf("%d", &temp);
        bl[temp] = 1;
    }
    scanf("%d", &g);
    for (i=0; i<g; i++) {
        scanf("%d", &temp);
        gl[temp] = 1;
    }
    i=0;
    while (b != n && g != m) {
        if (bl[i%n] || gl[i%m]) {
            bl[i%n] = 1; b++;
            gl[i%m] = 1; g++;
        }
        else if (i>10000) {
            printf("No\n");
            return 0;
        }

        i++;
    }
    printf("Yes\n");
    return 0;
}