#include #define be(v) (v).begin(),(v).end() #define pb(q) push_back(q) typedef long long ll; using namespace std; const ll mod=1000000007, INF=(1LL<<60); #define doublecout(a) cout< 0) { if (n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res; } int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); ll n, k, ans = 1; cin >> n >> k; vector a(k+1, 0LL); ll fac[100]; fac[0] = 1; for(ll i = 1; i < 100; i++){ fac[i] = (fac[i - 1] * i) % mod; } for(int i=1;i<=k;i++){ cin >> a[i]; } a.pb((1LL << n) - 1); for(int i=1;i<=k+1;i++){ if((a[i] & a[i - 1]) == a[i - 1]){ ans *= fac[__builtin_popcount(a[i] - a[i - 1])]; ans %= mod; }else{ ans = 0; } } cout << ans << endl; return 0; }