import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] inf = 10**16 md = 998244353 # md = 10**9+7 n, k = LI() aa = LI() cnt = [0]*1024 for a in aa: cnt[a] += 1 if k > 10: print(0) exit() def add(i, j, val): dp[i][j] = (dp[i][j]+val)%md dp = [[0]*(1 << 10) for _ in range(k+1)] dp[0][0] = 1 for a in range(1 << 10): if cnt[a] == 0: continue for i in range(k): for s in range(1 << 10): if s & a: continue pre = dp[i][s] if pre == 0: continue add(i+1, s | a, pre*cnt[a]) ans = 0 for s in range(1 << 10): ans += dp[k][s] ans %= md print(ans)