#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long mod = pow(10, 9) + 7LL;
  long long N, M;
  cin >> N >> M;
  vector<long long> a(M);
  vector<bool> check(N + 1);
  for (int i = 0; i < M; i++) {
    cin >> a[i];
    check[a[i]] = true;
    if (i) {
      if (a[i] - 1 == a[i - 1]) {
        cout << 0 << endl;
        return 0;
      }
    }
  }
  vector<long long> c(N + 1);
  c[1] = 1;
  c[2] = 2;
  c[3] = 3;
  for (int i = 4; i <= N; i++) {
    c[i] = c[i - 2] * 2 % mod + c[i - 3];
    c[i] %= mod;
  }
  long long count = 0;
  long long ans = 1;
  for (int i = 1; i <= N; i++) {
    if (check[i]) {
      if (count > 0) ans *= c[count];
      ans %= mod;
      count = -1;
    } else {
      count++;
    }
  }
  if (count > 0) ans *= c[count];
  ans %= mod;
  cout << ans << endl;
}
