#include #define rep(i, a, n) for(int i = a; i < n; i++) #define repb(i, a, b) for(int i = a; i >= b; i--) #define all(a) a.begin(), a.end() #define o(a) cout << a << endl #define int long long using namespace std; typedef pair P; const int mod = 1e9 + 7; int n, k; string changeto2(int m){ string res = ""; if(m == 0) res = "0"; while(1 <= m){ res += '0' + m % 2; m /= 2; } if(res.size() < n){ int tmp = n - res.size(); rep(i, 0, tmp){ res += "0"; } } reverse(all(res)); return res; } long long mod_pow(long long x,long long n){ if(n == 0) return 1; long long res = mod_pow(x*x % mod, n / 2); if(n & 1) res = res*x % mod; return res; } signed main(){ cin >> n >> k; vector d; vector f(n); d.push_back(0); rep(i, 0, k){ int a; cin >> a; d. push_back(a); } int MAX = mod_pow(2, n) - 1; if(d[k] != MAX) d.push_back(MAX); int ans = 1; bool g = true; rep(i, 0, d.size() - 1){ int tmp = d[i + 1] - d[i]; string s = changeto2(tmp); int cnt = 0; rep(j, 0, s.size()){ if(s[j] == '1'){ if(!f[j]){ f[j] = true; cnt++; }else{ g = false; i = d.size(); break; } } } rep(i, 0, cnt){ ans = (ans * (i + 1)) % mod; } // cout << cnt << endl; } if(!g) ans = 0; cout << ans << endl; }