#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define ll long long
#define vi vector<int>
#define pii pair<int,int>
#define F first
#define S second
#define pb push_back
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repr(i, a, b) for(int i = a - 1; i >= b; i--)
#define iter(m) for(auto it = m.begin(); it != m.end(); it++)
#define iterr(m) for(auto it = m.rbegin(); it != m.rend(); it++)
#define N 500500
#define PI 3.14159265358979323846264338327950L
#define speed ios_base :: sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
const ll mod = (ll)1e9 + 7;
    
int main(){
    speed;
    int n, h; cin >> n >> h;
    int matrix[n][n];
    rep(i, 0, n) {
        rep(j, 0, n) {
            cin >> matrix[i][j];
        }
    }
    vector<int> path;
    rep(i, 0, n) {
        path.push_back(i);
    }
    int cnt = 0;
    do {
        int sum = 0;
        rep(i, 0, n) {
            sum += matrix[path[i]][path[(i + 1) % n]];
        }
        if(sum == h && path[0] == 0) cnt++;
    } while(next_permutation(all(path)));
    cout << cnt;
    return 0;
}
#include<bits/stdc++.h>
typedef long long  ll;
using namespace std;
int main()
{

    ll a,b;
    cin>>a>>b;
    if(a==b)
    {
        vector<ll>v;
        for(ll i=1; i<=a; i++)
        {
            v.push_back(i);
            v.push_back(i*-1);
        }
        ll si=v.size();
        for(ll i=0; i<si-1; i++)
        {
            cout<<v[i]<<" ";
        }
        cout<<v[si-1]<<endl;
    }
    else
    {

        if(a>b)
        {
            vector<ll>v;
            for(ll i=1; i<=a; i++)
            {
                v.push_back(i);
            }

            for(ll i=1; i<b; i++)
            {
                v.push_back(i*-1);
            }
            ll res=(a*(a+1))/2;
            ll res1=(b*(b-1))/2;
            ll finalres=(res-res1)*-1;
            v.push_back(finalres);
            ll si=v.size();
            for(ll i=0; i<si-1; i++)
            {
                cout<<v[i]<<" ";
            }
            cout<<v[si-1]<<endl;
        }
       else if(b>a)
        {
            vector<ll>v;
            for(ll i=1; i<=b; i++)
            {
                v.push_back(i*-1);
            }

            for(ll i=1; i<a; i++)
            {
                v.push_back(i);
            }
            ll res=(b*(b+1))/2;
            ll res1=(a*(a-1))/2;
            ll finalres=(res-res1);
            v.push_back(finalres);
            ll si=v.size();
            for(ll i=0; i<si-1; i++)
            {
                cout<<v[i]<<" ";
            }
            cout<<v[si-1]<<endl;
        }


    }

}


