#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a % b == 0) {
    return b;
  } else {
    return (gcd(b, a % b));
  }
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int INF = 1e9;
const long long MX = 1e18;
const long long MOD = INF + 7;
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const double PI = acos(-1);
const long long MAX = 1000001;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (long long 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(long long n, long long 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() {
  COMinit();
  long long n, m;
  cin >> n >> m;
  vector<long long> a(m);
  for (long long i = 0; i < (m); i++) cin >> a[i];
  bool jat = false;
  for (long long i = 1; i <= (m - 1); ++i) {
    if (a[i] - a[i - 1] == 1) jat = true;
  }
  if (jat) {
    cout << 0 << endl;
    return 0;
  }
  long long cnt = 0;
  long long ans = 1;
  long long state = 0;
  long long ja = 0;
  long long ja1 = 0;
  long long ja2 = 0;
  for (long long i = 0; i < (m); i++) {
    cnt = 0;
    ja = a[i] - state - 1;
    ja1 = ja / 2 + ja % 2;
    ja2 = ja / 2;
    while (ja2 > 0) {
      cnt += COM(ja1, ja2) % MOD;
      cnt %= MOD;
      ja1++;
      ja2--;
    }
    cnt++;
    ans *= cnt;
    ans %= MOD;
    state = ja + 2;
  }
  cnt = 0;
  ja = n - state;
  ja1 = ja / 2 + ja % 2;
  ja2 = ja / 2;
  while (ja2 > 0) {
    cnt += COM(ja1, ja2) % MOD;
    cnt %= MOD;
    ja1++;
    ja2--;
  }
  cnt++;
  ans *= cnt;
  ans %= MOD;
  cout << ans << endl;
}
