#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
const int INF = 1e9;
const long long LINF = 1e18;
const double EPS = 1e-9;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
void yes() { cout << "Yes" << endl; }
void no() { cout << "No" << endl; }
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> f(n + 2, 1);
  f[n + 1] = 0;
  for (int(i) = 0; (i) < (int)(m); i++) {
    int a;
    cin >> a;
    f[a] = 0;
  }
  long long ans = 1;
  int i = 0;
  while (i != n) {
    if (f[i + 1] == 0 && f[i + 2] == 0) {
      cout << 0 << endl;
      return 0;
    } else if (f[i + 1] == 1 && f[i + 2] == 0) {
      ans *= 1;
      i = i + 1;
    } else if (f[i + 1] == 0 && f[i + 2] == 1) {
      ans *= 1;
      i = i + 2;
    } else {
      ans = ans * 2 % 1000000007;
      i = i + 2;
    }
  }
  cout << ans << endl;
  return 0;
}
