#include #define FOR(i,a,b) for (int i=(a);i<(b);i++) #define FORR(i,a,b) for (int i=(a);i>=(b);i--) #define pb push_back using namespace std; typedef long long ll; typedef pair pii; typedef vector vi; typedef set si; const int inf = 1e9; const int mod = 1e9+7; ll f[65]; vi a; int bc(ll i){ int co = 0; while(i > 0){ if(i&1)co++; i >>= 1; } return co; } main(){ cin.tie(0); ios::sync_with_stdio(false); f[0] = 1; FOR(i, 1, 65) f[i] = f[i-1] * i % mod; int n, k; cin >> n >> k; a.pb(0); FOR(i, 0, k){ ll b; cin >> b; a.pb(b); } a.pb((1ll << n) - 1); sort(a.begin(), a.end()); ll ans = 1; FOR(i, 1, a.size()){ if((a[i] & a[i-1]) != a[i-1]){ ans = 0; break; } ans = ans * f[bc(a[i]) - bc(a[i-1])] % mod; } cout << ans << endl; }