#include <bits/stdc++.h>

template <typename T> inline void rd(T& x) {
	int si = 1; char c = getchar(); x = 0;
	while(!isdigit(c)) si = c == '-' ? -1 : si, c = getchar();
	while(isdigit(c)) x = x * 10 + c - 48, c = getchar();
	x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args) { rd(x); rd(args...); }
#define fi first
#define se second
#define mkp std::make_pair
typedef long long ll;
typedef double ff;
typedef std::pair <int, int> pii;
const int N = 1e5 + 5, B = 14, Inf = 0x3f3f3f3f, Mod = 998244353;
const ll InfLL = 0x3f3f3f3f3f3f3f3fLL;

int QPow(int a, int b) {
	int ret = 1, bas = a;
	for(; b; b >>= 1, bas = 1LL * bas * bas % Mod)
		if(b & 1) ret = 1LL * ret * bas % Mod;
	return ret;
}

int n, m, f[B][N], fac[N], fac_inv[N];
void Init() {
	fac[0] = 1;
	for(int i = 1; i <= n; ++i) fac[i] = 1LL * fac[i - 1] * i % Mod;
	fac_inv[n] = QPow(fac[n], Mod - 2);
	for(int i = n - 1; ~i; --i) fac_inv[i] = 1LL * fac_inv[i + 1] * (i + 1) % Mod;
}
int C(int x, int y) {
	return 1LL * fac[x] * fac_inv[x - y] % Mod * fac_inv[y] % Mod;
}
void Calc() {
	f[0][0] = 1;
	for(int i = 1; i < B; ++i) {
		for(int j = 0; j <= m; ++j) {
			for(int k = 0; k * (1 << (i - 1)) <= j && k <= n; k += 2) 
				f[i][j] = (1LL * f[i - 1][j - k * (1 << (i - 1))] * C(n, k) + f[i][j]) % Mod;
		}
	}
}

int main() {
#ifndef ONLINE_JUDGE
	freopen("a.in", "r", stdin);
	freopen("a.out", "w", stdout);
#endif
	int test_case_cnt = 1; //rd(test_case_cnt);
	while(test_case_cnt--) {
		rd(n, m); Init(); Calc();
		printf("%d\n", f[B - 1][m]);
	} return 0;
}
# include <bits/stdc++.h>

using namespace std;

int a[10][10];

int main() {

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			cin >> a[i][j];
		}
	}
	vector<int> v;
	for (int i = 1; i < n; ++i) {
		v.push_back(i);
	}
	int cnt = 0;
	do {
		int total = 0 ;
		total += a[0][v[0]];
		for (int i = 1; i < v.size(); ++i) {
			total += a[v[i - 1]][v[i]];
		}
		total += a[0][v[v.size() - 1]];
		if (total == k) {
			cnt += 1;
		}
	} while (next_permutation(v.begin(), v.begin() + v.size()));
	cout << cnt << endl;
}