N,K = map(int,input().split()) A = list(map(int,input().split())) P = 998244353 import sys if K > 10: print(0) exit() C = 2 ** 10 dp = [[[0] * C for _ in range(K+1)] for _ in range(C)] dat = [0] * C dp[0][0][0] = 1 for a in A: dat[a] += 1 for bit in range(C-1): for k in range(K+1): for S in range(C): dp[bit + 1][k][S] += dp[bit][k][S] if (bit+1) & S == 0 and k < K: dp[bit + 1][k+1][S | (bit+1)] += dp[bit][k][S] * dat[bit+1] % P dp[bit+1][k+1][S | (bit+1)] %= P ans = sum(dp[-1][K]) % P print(ans)