/* -*- coding: utf-8 -*- * * 1189.cc: No.1189 Sum is XOR - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 200000; const int BN = 10; const int BBITS = 1 << BN; const int MOD = 998244353; /* typedef */ /* global variables */ int cs[BBITS], dp[2][BBITS][BN + 1]; /* subroutines */ inline void addmod(int &a, int b) { a = (a + b) % MOD; } /* main */ int main() { int n, k; scanf("%d%d", &n, &k); if (k > BN) { puts("0"); return 0; } for (int i = 0; i < n; i++) { int ai; scanf("%d", &ai); cs[ai]++; } dp[0][0][0] = 1; int cur = 0, nxt = 1; for (int ai = 0; ai < BBITS; ai++) { int ci = cs[ai]; if (ci > 0) { memcpy(dp[nxt], dp[cur], sizeof(dp[cur])); for (int bits = 0; bits < BBITS; bits++) if (! (ai & bits)) for (int i = k - ci; i >= 0; i--) addmod(dp[nxt][bits | ai][i + ci], dp[cur][bits][i]); swap(cur, nxt); } } int sum = 0; for (int bits = 0; bits < BBITS; bits++) addmod(sum, dp[cur][bits][k]); printf("%d\n", sum); return 0; }