#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
int main() {
  long long N, M;
  cin >> N >> M;
  vector<long long> V(M);
  for (int i = 0; i < M; i++) {
    cin >> V[i];
    if (i != 0)
      if (V[i - 1] + 1 == V[i]) {
        cout << 0 << endl;
        return 0;
      }
  }
  long long ans = 1;
  vector<long long> T(100005);
  T[0] = 1;
  T[1] = 1;
  for (int i = 2; i <= 100005; i++) T[i] = (T[i - 1] + T[i - 2]) % MOD;
  ans *= T[V[0] - 0 - 1];
  for (int i = 1; i < V.size(); i++) {
    ans *= T[V[i] - V[i - 1] - 2];
    ans %= MOD;
  }
  ans *= T[N - V[M - 1] - 1];
  ans %= MOD;
  cout << ans << endl;
}
