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