#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
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(void) {
  COMinit();
  int n, m;
  int lastA = -1;
  cin >> n >> m;
  int index = 0;
  vector<long long> ans(n, 0);
  for (int i = 0; i < m; i++) {
    int a;
    cin >> a;
    if (a - lastA == 1) {
      ans[index] = 0;
      break;
    } else if (a == lastA) {
      ans[index] = 1;
      index++;
      continue;
    } else {
      int now = lastA + 1;
      int diff = a - now - 1;
      for (int i = 0; i < diff / 2 + 1; i++) {
        if (i == 0 || i == diff / 2 && diff % 2 == 0)
          ans[index] += 1;
        else {
          ans[index] += (COM(diff - i, i) % (1000000007));
          ans[index] %= 1000000007;
        }
      }
      lastA = a;
      index++;
    }
  }
  int a = n;
  if (a - lastA == 1) {
    ans[index] = 0;
  } else if (a == lastA)
    ;
  else {
    int now = lastA + 1;
    int diff = a - now;
    for (int i = 0; i < diff / 2 + 1; i++) {
      if (i == 0 || i == diff / 2 && diff % 2 == 0)
        ans[index] += 1;
      else {
        ans[index] += (COM(diff - i, i) % (1000000007));
        ans[index] %= 1000000007;
      }
    }
    lastA = a;
  }
  long long as = 1;
  for (int i = 0; i < m + 1; i++) {
    as = (as * ans[i]) % 1000000007;
  }
  cout << as << endl;
}
