#include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<vector>
#include<set>
#include<queue>
#include<stack>
#include <math.h>
#include<climits>
using namespace std;
#define int long long
#define vi vector<int>
#define vpii vector<pair<int,int>>
#define pii pair<int,int>
#define ff first
#define ss second
#define print(x) cout<<x<<"\n"
#define printt(x,y) cout<<x<<" "<<y<<"\n"
#define printtt(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n"
#define pb push_back
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define all(v) v.begin(),v.end()
#define vvi vector<vector<int>>
#define maxq priority_queue<int>
#define minq priority_queue<int,vector<int>,greater<int>>
#define mod 1000000007
#define N 200009
#define atmod 998244353

bool cmp(pii &a, pii &b) {

	return a.ff > b.ff;
}

void solve() {

	int n, k;
	cin >> n >> k;

	int a[10][10];
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= n; j++)
			cin >> a[i][j];

	vector<int> v;
	for (int i = 2; i <= n; i++)
		v.pb(i);

	int cnt = 0;
	do {
		int s = 0;
		int p = 1;
		//cout << 1 << " ";
		for (int i = 0; i < v.size(); i++) {
			int j = v[i];
			//cout << v[i] << " ";
			int val = a[p][v[i]];
			s = s + val;
			p = j;
		}

		s = s + a[p][1];
		if (s == k)
			cnt++;
		//cout << 1 << "\n";

	} while (next_permutation(all(v)));

	print(cnt);

}

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	int t = 1;
	//cin >> t;
	while (t--) {
		solve();
	}
}
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<fixed<<setprecision(15)<<head;print0(tail...);}
void print() { print0("\n"); }
template<typename Head,typename... Tail>void print(Head head,Tail... tail){print0(head);if(sizeof...(Tail)>0)print0(" ");print(tail...);}
// clang-format on

const ll MODULO = 998244353;
ll mod_minus(ll x, ll modval) {
    if (x >= 0) {
        return x % modval;
    } else {
        ll mm = ((-x) % modval);
        if (mm == 0) {
            return 0;
        } else {
            return modval - mm;
        }
    }
}
ll mod(ll x) {
    return mod_minus(x, MODULO);
}

const ll COMBMAX = 212345;
ll fac[COMBMAX], finv[COMBMAX], inv[COMBMAX];
void combination_init() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < COMBMAX; i++) {
        fac[i] = fac[i - 1] * i % MODULO;
        inv[i] = MODULO - inv[MODULO % i] * (MODULO / i) % MODULO;
        finv[i] = finv[i - 1] * inv[i] % MODULO;
    }
}
ll combination(ll n, ll k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MODULO) % MODULO;
}

int main() {
    ll N, K;
    cin >> N >> K;

    vector<ll> a(N);
    for (ll i = 0; i < N; i++) {
        cin >> a[i];
    }

    vector<ll> apow(N, 1);
    vector<ll> powsum(K + 1, 0);
    powsum[0] = N;
    for (ll k = 1; k <= K; k++) {
        for (ll i = 0; i < N; i++) {
            apow[i] = (apow[i] * a[i]) % MODULO;
            powsum[k] = (powsum[k] + apow[i]) % MODULO;
        }
    }

    combination_init();
    for (ll k = 1; k <= K; k++) {
        ll result = 0;
        for (ll m = 0; m * 2 <= k; m++) {
            ll v = 0;
            v = mod(powsum[m] * powsum[k - m]);
            v = mod(v - powsum[k]);
            v = mod(combination(k, k - m) * v);
            if (m * 2 == k) {
                v = mod(finv[2] * v);
            }
            result = mod(v + result);
        }
        print(result);
    }
}
