#include using namespace std; const int mod = 1e9 + 7; int main() { int n, k; cin >> n >> k; vector a(k + 2); for (int i = 0; i < k; i++) { cin >> a[i]; } a.back() = (1LL << n) - 1; sort(a.begin(), a.end()); int64_t ans = 1; for (int i = 0; i < a.size() - 1; i++) { if (a[i] & ~a[i + 1]) { ans = 0; } int cnt = 0; int64_t d = a[i] ^ a[i + 1]; for (int64_t d = a[i] ^ a[i + 1]; d > 0; d &= d - 1) { ans *= ++cnt; ans %= mod; } } cout << ans << endl; }