#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;
}
long long calc(long long div) {
  long long count = div / 2;
  long long ret = 0;
  for (long long i = 0; i <= count; i++) {
    ret += comb_mod(div - i, i) % 1000000007;
  }
  return ret;
}
int main() {
  long long n = 0, m = 0;
  cin >> n >> m;
  long long ans = 1;
  long long now = 0, pre = 0;
  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;
    }
    ans *= calc(div) % 1000000007;
    ans %= 1000000007;
  }
  ans *= (calc(n - now - 1) % 1000000007);
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
