#include <bits/stdc++.h>

using namespace std;

#define  ll long long
#define ld long double
#define f first
#define s second

ll n , m , mod = 998244353 , a[22][55555]  , dp[22] , P[22][22];

ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void calc(vector<ll> v)
{
    sort(v.begin() , v.end() , greater<ll>() );
    memset(dp , 0 , sizeof(dp));
    int j=0 , valid=0;
    dp[0] = 1;
    for(int i=1; i<=n; i++) //dp[i] = probability that first i cities will not have curr point
    {
        while(j < v.size() && n-i+1 < v[j])
        {
            valid++;
            j++;
        }

        if (!valid) return;

        int rem = n-i+1;
        dp[i] = (P[valid][rem] * dp[i-1])%mod;
        valid--;
    }
}

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    for(int i=1; i<=20; i++)
    {
        for(int j=1; j<=20; j++)
        {
            P[i][j] = (1ll*i*fp(j , mod-2))%mod;
        }
    }

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

    ll ans = 0;
    for(ll i=1; i<=m; i++)
    {
        vector<ll> v;
        for(int j=1; j<=n; j++)
        {
            v.push_back(a[j][i]);
        }

        calc(v);
        ans = (ans + (1 - dp[n] + mod))%mod;
    }

    cout << ans << '\n';

    return 0;
}