#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long int ll;
int main(void) {
	int n, m, a, b=-10; cin >> n >> m;
	bool t = true;
	ll ans = 0;
	for (int i = 0; i < m; i++){
		cin >> a;
		if (b + 1 == a) {
			t = false; break;
		}
		b = a;
	}
	if (t) {
		ll s=pow(2,(n-2*m)/2);
		ans = s % 1000000007;
	}
	cout << ans << endl;

	return 0;
}