#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; int main() { int n, k; long long a[66]; cin >> n >> k; for (int i = 1; i <= k; i++) { cin >> a[i]; if (a[i] == 0) { i--; } } a[0] = 0, a[k + 1] = (1 << n) - 1; sort(a, a + k); long long ans = 1; for (int i = 1; i <= k + 1; i++) { long long co = 0; for (int j = 0; j < n; j++) { if (!(a[i] & (1 << j)) && (a[i - 1] & (1 << j))) { cout << 0 << endl; return 0; } if ((a[i] & (1 << j)) && !(a[i - 1] & (1 << j))) { co++; } } for (long long j = co; j > 0; j--) { ans *= j; ans %= 1000000007; } } cout << ans << endl; return 0; }