#include using namespace std; const int mod = 1e9 + 7; int main() { int n, k; cin >> n >> k; vector a(k); for (int i = 0; i < k; i++) { cin >> a[i]; } sort(a.begin(), a.end(), [](int64_t a, int64_t b) { return __builtin_popcountll(a) < __builtin_popcountll(b); }); a.insert(a.begin(), 0); a.push_back((1LL << n) - 1); vector fact(100); fact[0] = 1; for (int i = 1; i < 100; i++) { fact[i] = i * fact[i - 1] % mod; } int64_t ans = 1; for (int i = 0; i < a.size() - 1; i++) { if ((a[i] & a[i + 1]) != a[i]) { cout << 0 << endl; return 0; } int diff = __builtin_popcountll(a[i] ^ a[i + 1]); ans *= fact[diff]; ans %= mod; } cout << ans << endl; }