#include #include #include using namespace std; typedef long long LL; const int N = 70, MOD = 1000000007; LL a[N]; bool ok; int n, k, pw[N], ans; int main() { // freopen("computer.in", "r", stdin); // freopen("computer.out", "w", stdout); scanf("%d%d", &n, &k); for (int i = 1; i <= k; ++i) scanf("%lld", &a[i]); sort(a + 1, a + n + 1); pw[0] = 1; for (int i = 1; i <= n; ++i) pw[i] = 1LL * pw[i - 1] * i % MOD; a[0] = 0LL, a[k + 1] = (1LL << n) - 1; ans = 1, ok = true; for (int i = 1; i <= k + 1; ++i) { if ((a[i - 1] & a[i]) != a[i - 1]) { ok = false; break; } int cnt = __builtin_popcountll(a[i]) - __builtin_popcountll(a[i - 1]); ans = 1LL * ans * pw[cnt] % MOD; } printf("%d\n", ok ? ans : 0); return 0; }