#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;
const ll MAX = 100000;
ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (ll 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(ll n, ll k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
void Main() {
  int N, M;
  cin >> N >> M;
  COMinit();
  ll ans = 1;
  ll cal;
  int a, x, now = 0;
  for (int i = (0); i <= (M - 1); ++i) {
    cin >> a;
    if (a == now - 1) continue;
    if (a == now) {
      cout << 0 << endl;
      return;
    }
    cal = 0;
    for (int i = (0); i <= ((a - now - 1) / 2); ++i) {
      cal += COM(a - now - 1 - i, i);
    }
    ans = (ans * cal) % MOD;
    now = a + 1;
  }
  cal = 0;
  for (int i = (0); i <= ((N - now) / 2); ++i) {
    cal += COM(N - now - i, i);
  }
  ans = (ans * cal) % MOD;
  cout << ans << endl;
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}
