#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a;
  vector<bool> broken(N - 1);
  for (int i = 0; i < M; i++) {
    int ai;
    cin >> ai;
    a.push_back(ai);
    broken[ai] = true;
  }
  sort(a.begin(), a.end());
  if (M >= 2) {
    for (int i = 0; i < M - 1; i++) {
      if (a[i + 1] - a[i] == 1) {
        cout << 0 << endl;
        return 0;
      }
    }
  } else if (N == M) {
    cout << 0 << endl;
    return 0;
  }
  int ans = 1;
  for (int i = N; i >= 2; i--) {
    int pat = 0;
    if (broken[i] == true) {
      continue;
    } else if (broken[i - 1] == false && broken[i - 2] == false) {
      pat = 2;
    } else {
      pat = 1;
    }
    ans = (ans * pat) % 1000000007;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
