#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
const double pi = acos(-1);
const double eps = 1e-8;
const ll mod = 1e9 + 7;
const ull base = 131;
const ull mod1 = 1e9 + 9;
const ull mod2 = 1610612741;


const int maxn = 1e3 + 10;
int a[100][100];
int n, t;
const ll m = 998244353;
int fa[100];

int find(int x)
{
    while (x != fa[x]) x = fa[x] = fa[fa[x]];
    return x;
}

int main()
{
    scanf("%d%d", &n, &t);
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j)
            scanf("%d", &a[i][j]);
    for (int i = 1; i <= n; ++i) fa[i] = i;
    for (int i = 1; i <= n; ++i)
        for (int j = i+1; j <= n; ++j)
        {
            bool flag = true;
            for (int k = 1; k <= n; ++k)
                if (a[i][k] + a[j][k] > t) flag = false;
            if (flag) fa[find(i)] = find(j);
        }

    ll ans = 1;
    map<int, int> mp;
    for (int i = 1; i <= n; ++i) ++mp[find(i)];
    for (auto p = mp.begin(); p != mp.end(); ++p)
        for (int i = 1; i <= p->second; ++i) ans = ans*i%m;

    for (int i = 1; i <= n; ++i) fa[i] = i;
    for (int i = 1; i <= n; ++i)
        for (int j = i+1; j <= n; ++j)
        {
            bool flag = true;
            for (int k = 1; k <= n; ++k)
                if (a[k][i] + a[k][j] > t) flag = false;
            if (flag) fa[find(i)] = find(j);
        }

    mp.clear();
    for (int i = 1; i <= n; ++i) ++mp[find(i)];
    for (auto p = mp.begin(); p != mp.end(); ++p)
        for (int i = 1; i <= p->second; ++i) ans = ans*i%m;

    printf("%lld\n", ans);
    return 0;
}
#include <bits/stdc++.h>          
using namespace std;
using ll = long long;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repp(i, st, en) for (ll i = (ll)st; i < (ll)(en); i++)
#define repm(i, st, en) for (ll i = (ll)st; i >= (ll)(en); i--)
#define all(v) v.begin(), v.end()
void chmax(ll &x, ll y) {x = max(x,y);}
void chmin(ll &x, ll y) {x = min(x,y);}
void Yes() {cout << "Yes" << endl; exit(0);}
void No() {cout << "No" << endl; exit(0);}
template<class in_Cout> void Cout(in_Cout x) {cout << x << endl; exit(0);}
template<class in_vec_cout>
void vec_cout(vector<in_vec_cout> vec) {
    for (in_vec_cout res : vec) {cout << res << " ";}
    cout << endl;
}

const ll inf = 1e18;
const ll mod = 998244353;
const ll len = 15;

// nCr (mod p) 計算量 O(3*10^5*logp)
const ll Maximum = 5500;
ll Fac[Maximum+1], iFac[Maximum+1];
bool made_Fac = false;
// x^n (mod p) 計算量 O(logn)
ll powmodp(ll x, ll n) {
    if (n==0) return 1;
    else if (n%2==0) {
        ll ans = powmodp(x,n/2);
        return ans*ans % mod;
    }
    else return x * powmodp(x,n-1) % mod;
}
// nCr (mod p) 計算量 O(3*10^5*logp)
void make_Fac() {
    Fac[0] = 1;
    iFac[0] = 1;
    for (ll i=0; i<Maximum; i++) {
        Fac[i+1] = Fac[i] * (i+1) % mod;
        iFac[i+1] = iFac[i] * powmodp(i+1,mod-2) % mod;
    }
}
ll nCrmodp(ll n, ll r) {
    if (!made_Fac) {
        make_Fac();
        made_Fac = true;
    }
    r = min(r,n-r);
    if (n==0 or r==0) return 1;
    ll tmp = iFac[n-r] * iFac[r] % mod;
    return tmp * Fac[n] % mod;
}

vector<ll> to_bin(ll X) {
    vector<ll> res(len);
    rep(i,len) {
        res[i] = X % 2;
        X /= 2;
    }
    return res;
}

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

    if (M%2) Cout(0);

    vector<ll> S = to_bin(M);

    vector<vector<ll>> dp(len,vector<ll>(N+1));
    for (ll cnt=0; cnt<=N; cnt+=2) dp[0][cnt/2] = nCrmodp(N,cnt);
    for (ll i=1; i<len; i++) {
        for (ll cnt=0; cnt<=N; cnt+=2) {
            rep(j,N) {
                if (j%2!=S[i]) continue;
                ll tmp = cnt + j;
                dp[i][tmp/2] += dp[i-1][j] * nCrmodp(N,cnt) % mod;
                dp[i][tmp/2] %= mod;
            }
        }
    }
    
    ll ans = dp[len-1][0];

    cout << ans << endl;
}