#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int diry[8] = {0, 1, -1, 0, -1, 1, -1, 1};
long long MOD = 1000000007;
int N, M;
const int MAX_M = 100000;
int a[MAX_M];
int main() {
  cin >> N >> M;
  for (int i = 0; i < M; i++) cin >> a[i];
  for (int i = 0; i < M - 1; i++) {
    if (a[i + 1] == a[i] + 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long dp[N];
  dp[0] = 1;
  dp[1] = 1;
  for (int i = 0; i < N - 2; i++) {
    dp[i + 2] = (dp[i + 1] + dp[i]) % MOD;
  }
  long long ans = dp[a[0] - 1];
  for (int i = 0; i < M - 1; i++) {
    ans = ans * dp[a[i + 1] - a[i] - 2] % MOD;
  }
  ans = ans * dp[N - 1 - a[M - 1]] % MOD;
  cout << ans << endl;
  return 0;
}
