#include #include #include using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 4000000000000000001 mint iv[300000]; int main(){ for(int i=1;i<300000;i++)iv[i] = mint(i).inv(); int M,N; cin>>M>>N; vector c(M); rep(i,N){ int a; cin>>a; c[a-1]++; } vector d(N+1); rep(i,c.size()){ d[c[i]]++; } vector num(N+1,1); for(int i=1;i<=N;i++){ if(d[i]==0)continue; mint t = 1; rep(j,i)t *= j+1; for(int j=i;j<=N;j++){ num[j] *= t.pow(d[i]); t *= j+1; t *= iv[j-i+1]; } rep(j,i)num[j] = 0; } vector x(N+1,0); x[0] = 1; { mint c = 1; for(int i=1;i<=N;i++){ c /= i; if(i%2==0)x[i] = c; else x[i] = -c; } } { mint c = 1; for(int i=1;i<=N;i++){ c /= i; num[i] *= c; } } x = convolution(x,num); mint ans= 0; { mint c = 1; for(int i=1;i<=N;i++){ c *= i; ans += x[i]*c; } } cout<