#include #include #include using namespace std; using lint = int64_t; constexpr lint mod = 998244353; inline bool f(int x, int y) { return x + y == (x xor y); } lint inv(lint x) { lint res = 1, expo = mod - 2; while (expo > 0) { if (expo & 1) { res *= x; res %= mod; } x *= x; x %= mod; expo >>= 1; } return res; } lint solve(int n, int k, const vector& a) { lint res = 0; if (k == 2) { for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if (f(a[i], a[j])) res++; } } return res; } else { vector>mp_vec(k - 2); for (int i = 0; i < n - 1; i++) { for (int j = i + 1; j < n; j++) { if (f(a[i], a[j])) mp_vec[0][a[i] xor a[j]]++; } } for (int i = 0; i < k - 2; i++) { for (auto [key, value] : mp_vec[i]) { for (int e : a) { if (f(key, e)) { if (i < k - 3) { mp_vec[i + 1][key xor e] += value; mp_vec[i + 1][key xor e] %= mod; } else { res += value; res %= mod; } } } } if (i < k - 3 && mp_vec[i + 1].empty()) return 0; } lint fact = 1; for (lint i = 3; i <= k; i++) { fact *= i; fact %= mod; } return res * inv(fact) % mod; } } int main() { int N, K; cin >> N >> K; vectorA(N); for (int& e : A) cin >> e; cout << solve(N, K, A) << endl; }