#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> step(N);
  vector<int> a(M);
  for (int i = 0; i < M; i++) {
    cin >> a[i];
    step[a[i] - 1] = 1;
  }
  long long mod = 1000000007;
  long long ans = 0;
  if (step[0] == 1 && step[1] == 1) {
    cout << 0 << endl;
    return 0;
  } else if (step[0] == 1 || step[1] == 1) {
    ans = 1;
  } else {
    ans = 2;
  }
  for (int i = 2; i < N; i++) {
    if (step[i] == 1) {
      continue;
    }
    if (step[i - 2] == 0 && step[i - 1] == 0) {
      ans *= 2;
      ans %= mod;
    } else if (step[i - 2] == 1 && step[i - 1] == 1) {
      ans = 0;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
