#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n, m;
	cin >> n >> m;
	int a[m];
	bool b[n] = {0};
	REP(i, m){
		cin >> a[i];
		b[a[i]] = 1;
	}
	ll ans = 1;

	for (int i = 2; i < n; i++){
		if (b[i] == 0 and b[i-1] == 0) ans *= 2;
		else if (b[i] == 1 and b[i-1] == 1){
			cout << 0 << endl;
			return 0;
		}
		ans %= 1000000007;
	}

	cout << ans << endl;

}
