#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vpii = vector<pair<int, int>>;
using vivi = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int mod = 10000007;
const int inf = 1001001001;
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) {
  int n, m;
  COMinit();
  cin >> n >> m;
  vi a(m);
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  vi s(m + 1);
  s[0] = a[0] - 1;
  for (int i = 0; i < (int)(m - 1); i++) s[i + 1] = a[i + 1] - a[i] - 2;
  s[m] = n - a[m - 1] - 1;
  ll sum = 1;
  for (int i = 0; i < (int)(m + 1); i++) {
    ll kamo = 0;
    for (int j = 0; j < (int)(s[i] / 2 + 1); j++) {
      kamo += COM(s[i] - j, j);
    }
    sum *= kamo % MOD;
    sum %= MOD;
  }
  cout << sum << endl;
}
