#include <bits/stdc++.h>

using namespace std;
int n, k;

int a[100][100];
constexpr int MOD = 998244353;

int fact(int n) {
  int s = 1;
  for (int i = 1; i <= n; i++) {
    s = 1ll * s* i % MOD;
  }
  return s;
}

int solve(vector<pair<int, int>> a, int n) {
  vector<vector<int>> ed(n + 1);
  vector<int> used(n + 1);
  for (auto e : a) {
   ed[e.first].emplace_back(e.second);
   ed[e.second].emplace_back(e.first);
  }
  int ans = 1;
  for (int i = 1; i <= n; i++) {
    if (used[i]) {
      continue;
    }
    int sz = 0;
    function<void(int)> dfs = [&](int v) {
      sz++;
      used[v] = 1;
      for (auto to : ed[v]) {
        if (used[to]) {
          continue;
        }
        dfs(to);
      }
    };

    dfs(i);
    ans = 1ll * ans * fact(sz) % MOD;
  }
  return ans;
}

int go(bool tr) {
  vector<pair<int, int>> ed;
  if (tr) {
    for (int x = 1; x <= n; x++) {
      for (int y = x + 1; y <= n; y++) {
        bool bad = false;
        for (int i = 1; i <= n; i++) {
          if (a[x][i] + a[y][i] > k) {
            bad = true;
          }
        }
        if (!bad) {
          ed.emplace_back(x, y);
        }
      }
    }
  } else {
    for (int x = 1; x <= n; x++) {
      for (int y = x + 1; y <= n; y++) {
        bool bad = false;
        for (int i = 1; i <= n; i++) {
          if (a[i][x] + a[i][y] > k) {
            bad = true;
          }
        }
        if (!bad) {
          ed.emplace_back(x, y);
        }
      }
    }
  }
  return solve(ed, n);
}


int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      cin >> a[i][j];
    }
  }
  cout << 1ll *go(0) * go(1) % MOD << "\n";

  return 0;
}
#include <cstdio>
#include <vector>

/*
A(x) = A(x^2) C(x^2)
*/


using u32 = unsigned int;
using u64 = unsigned long long;

template <u32 MOD>
struct Mint {
  u32 n;
  constexpr Mint(u32 n = 0): n(n) {}
  constexpr Mint operator-() const { return Mint(n ? MOD - n: 0); }
  constexpr Mint &operator+=(const Mint &rhs){ n += rhs.n; if(n >= MOD) n -= MOD; return *this; }
  constexpr Mint &operator-=(const Mint &rhs){ if(rhs.n > n) n += MOD; n -= rhs.n; return *this; }
  constexpr Mint &operator*=(const Mint &rhs){ n = (u64) n * rhs.n % MOD; return *this; }
  friend constexpr Mint operator+(const Mint &lhs, const Mint &rhs){ return Mint(lhs) += rhs; }
  friend constexpr Mint operator-(const Mint &lhs, const Mint &rhs){ return Mint(lhs) -= rhs; }
  friend constexpr Mint operator*(const Mint &lhs, const Mint &rhs){ return Mint(lhs) *= rhs; }
  friend constexpr bool operator==(const Mint &lhs, const Mint &rhs){ return lhs.n == rhs.n; }
  friend constexpr bool operator!=(const Mint &lhs, const Mint &rhs){ return lhs.n != rhs.n; }
};

template <class T>
T modpow(T x, int n){
  T r(1);
  for(; n; n >>= 1){
    if(n&1) r *= x;
    x *= x;
  }
  return r;
}

template <u32 MOD>
Mint<MOD> inv(Mint<MOD> n){
  return modpow(n, MOD-2);
}


constexpr u32 mod = 998244353;
using mint = Mint<mod>;


int main(){
  int n, m;
  scanf("%d%d", &n, &m);
  std::vector<mint> C;
  C.push_back(1);
  for(int i = 1; i <= n/2; i++){
    C.push_back(C.back() * mint(n+2-2*i) * mint(n+1-2*i) * inv(mint(2*i * (2*i-1))));
  }
  std::vector<mint> D(n+1);
  D[0] = 1;
  for(; m; m >>= 1){
    std::vector<mint> E(n/2+1);
    for(int i = m&1; i <= n; i+=2){
      E[i/2] = D[i];
    }
    for(int i = 0; i <= n; i++) D[i] = 0;
    for(int i = 0; i <= n/2; i++){
      for(int j = 0; j <= n/2; j++){
        D[i+j] += C[i] * E[j];
      }
    }
  }
  printf("%d\n", D[0].n);
  return 0;
}
