#include <bits/stdc++.h>
using namespace std;
long long inv(long long n) {
  long long ans = 1;
  while (n > 1) {
    ans = ans * (1000000007 - 1000000007 / n) % 1000000007;
    n = 1000000007 % n;
  }
  return ans;
}
long long comb_mod(long long n, long long r) {
  long long deno = 1;
  long long mole = 1;
  long long r_change = 0;
  if (r <= n / 2)
    r_change = r;
  else
    r_change = n - r;
  for (long long i = 1; i <= r_change; i++) {
    mole = mole * i;
    mole = mole % 1000000007;
  }
  for (long long i = n - r_change + 1; i <= n; i++) {
    deno = deno * i;
    deno = deno % 1000000007;
  }
  mole = inv(mole);
  return (mole * deno) % 1000000007;
}
int main() {
  long long n = 0, m = 0;
  cin >> n >> m;
  long long ans = 1;
  long long now = 0, pre = 0;
  if (m == 0) now++;
  vector<long long> memo(n + 1);
  for (long long i = 0; i < m; i++) {
    pre = now;
    cin >> now;
    long long div = 0;
    if (pre == now) continue;
    if (pre) {
      div = now - pre - 2;
      if (now == pre + 1) {
        cout << 0 << endl;
        return 0;
      }
    } else {
      div = now - 1;
    }
    if (memo.at(div) != 0) {
      ans *= memo.at(div);
      ans %= 1000000007;
    } else {
      long long count = div / 2;
      long long step = 0;
      for (long long i = 0; i <= count; i++) {
        step += comb_mod(div - i, i) % 1000000007;
        step %= 1000000007;
      }
      ans *= step;
      ans %= 1000000007;
      memo.at(div) = step;
    }
  }
  if (memo.at(n - now - 1) != 0) {
    ans *= memo.at(n - now - 1);
    ans %= 1000000007;
  } else {
    long long count = (n - now - 1) / 2;
    long long step = 0;
    for (long long i = 0; i <= count; i++) {
      step += comb_mod(n - now - 1 - i, i) % 1000000007;
      step %= 1000000007;
    }
    ans *= step;
    ans %= 1000000007;
  }
  cout << ans << endl;
  return 0;
}
