#include<bits/stdc++.h>
using namespace std;
long long M = 1e9+7;
long long pw(long long x, long long n) {
if(n == 1) return x;
if(n == 0) return 1;
if(n%2==0) {
long long bb = pw(x,n/2);
return (bb*bb)%M;
}
else {
return ((pw(x,n-1)*x)%M);
}
}
int main() {
int n,m;cin>>n>>m;
long long sv; long long so;
sv = 0; so = 0;
if(m == 0) { sv = n-2; so = n-2; goto res;}
bool kr[1010101];
set<long> fb;
kr[1] = true;
for(int i = 0; i < m; i++) {
long a; cin >> a;
fb.insert(a);
}
int k = 1;
long it = 2;
bool inte = false;
long pro = 0;
while(k < n) {
if(k == n-1 && !inte) pro = it;
long kk = pw(2,k);
for(int i = 0; i < kk; i++) {
if(fb.count(it)) kr[i] = false;
else {
kr[it] = kr[it/2];
}
it++;
}
k++;
}
//cout << "\n";
for(int i = pro; i < pro+pro/2; i++) {
if(kr[i]) sv++;
//cout << kr[i] << " ";
}
for(int i = pro+pro/2; i < 2*pro; i++) {
if(kr[i]) so++;
//cout << kr[i] << " ";
}
//cout << endl;
//cout << sv << " :: " << so << "\n";
res:
cout << (((sv*so)%M)*2)%M;
}