#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
const long long MOD = 1000000007;
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  long long ans = 1;
  COMinit();
  long long N, M;
  int a = -1;
  cin >> N >> M;
  for (int i = 0; i < (M + 1); ++i) {
    long long b = N + 1;
    if (i < M) cin >> b;
    long long c = b - a - 2;
    if (b != 1 && c == 0) {
      ans = 0;
      break;
    }
    long long com = 0;
    for (int j = 0; j < (c / 2 + 1); ++j) {
      com += COM(c - j, j);
    }
    ans *= com % MOD;
    ans = ans % MOD;
    a = b;
  }
  cout << ans << endl;
}
