#include #include #include #include using namespace std; const int mod = 1e9 + 7; vector make_fact(int n_max = 60) { vector fact(n_max + 1, 1LL); for (int i = 2; i <= n_max; i++) { fact[i] = fact[i - 1] * i % mod; } return fact; } int main() { int n, k; cin >> n >> k; vector a(k, 0); for (int i = 0; i < k; i++) { cin >> a[i]; } a.emplace_back(0); a.emplace_back((1LL << n) - 1); sort(a.begin(), a.end()); auto fact = make_fact(); long long ret = 1; for (int i = 1; i < a.size(); i++) { if ((a[i] | a[i - 1]) != a[i]) { ret = 0; break; } int diff = __builtin_popcountll(a[i]) - __builtin_popcountll(a[i - 1]); // printf("%10lld %d\n", a[i], diff); ret = ret * fact[diff] % mod; } cout << ret << endl; return 0; }