#include #include int cmp_int_rev (const void *ap, const void *bp) { int a = *(int *)ap; int b = *(int *)bp; if (a < b) { return 1; } if (a > b) { return -1; } return 0; } long long power_mod (long long a, long long b, long long mod_num) { long long ans = 1LL; if (b > 0LL) { ans = power_mod(a, b/2LL, mod_num); ans = (ans * ans) % mod_num; if (b%2LL == 1LL) { ans = (ans * (a % mod_num)) % mod_num; } } return ans; } int main () { int m = 0; int n = 0; int a = 0; int res = 0; long long ans = 0LL; long long mod_num = 998244353LL; long long s[100001] = {}; long long b[100001] = {}; long long fact[100002] = {}; long long invf[100002] = {}; int c[100001][2] = {}; int cnt = 0; res = scanf("%d", &m); res = scanf("%d", &n); for (int i = 0; i < n; i++) { res = scanf("%d", &a); c[a][0]++; } fact[0] = 1LL; for (int i = 0; i < n+1; i++) { fact[i+1] = fact[i]; fact[i+1] *= (long long) (i+1); fact[i+1] %= mod_num; } invf[n+1] = power_mod(fact[n+1], mod_num-2LL, mod_num); for (int i = n+1; i > 0; i--) { invf[i-1] = invf[i]; invf[i-1] *= (long long)i; invf[i-1] %= mod_num; } qsort(c, m+1, sizeof(int)*2, cmp_int_rev); c[0][1] = 1; cnt = 1; for (int i = 1; i <= m; i++) { if (c[i-1][0] != c[i][0]) { c[cnt][0] = c[i][0]; c[cnt][1] = 0; cnt++; } c[cnt-1][1]++; } for (int i = 1; i <= n; i++) { s[i] = 1LL; } for (int i = 0; i < cnt; i++) { for (int j = 0; j < c[i][0]; j++) { s[j] = 0LL; } for (int j = c[i][0]; j <= n; j++) { long long mul = fact[j]; mul *= invf[j-c[i][0]]; s[j] *= power_mod(mul, (long long)c[i][1], mod_num); s[j] %= mod_num; } } if (n%2 == 0) { b[1] = ((long long)(n/2))*(-1LL)+mod_num; b[1] %= mod_num; } else { b[1] = ((long long)(n/2))+1LL; } for (int i = 2; i <= n; i++) { b[i] = fact[n+1]; b[i] *= invf[i]; b[i] %= mod_num; b[i] *= invf[n-i+1]; b[i] %= mod_num; b[i] += mod_num-b[i-1]; b[i] *= (mod_num+1LL)/2LL; if (n%2 == 0) { long long sub = fact[n+1]; sub *= invf[i]; sub %= mod_num; sub *= invf[n-i+1]; b[i] += mod_num-sub%mod_num;; } b[i] %= mod_num; } for (int i = 1; i <= n; i++) { if (i%2 == 1) { ans += (b[i]*s[i])%mod_num; } else { ans += mod_num-(b[i]*s[i])%mod_num; } } printf("%lld\n", ans%mod_num); return 0; }