#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int MM = 1299;
long long powmod(long long a1, long long b1, long long modx = mod) {
  long long res = 1;
  a1 %= modx;
  for (; b1; b1 >>= 1) {
    if (b1 & 1) res = res * a1 % modx;
    a1 = (a1 * a1) % modx;
  }
  return res;
}
long long inv(long long ax, long long modx = mod) {
  return powmod(ax, modx - 2, modx);
}
long long fac[MM], ifac[MM];
void preFac(long long modx = mod) {
  fac[0] = 1;
  ifac[0] = 1;
  for (int i = 1; i < MM; i++) {
    fac[i] = (i * fac[i - 1]) % modx;
  }
  ifac[MM - 1] = inv(fac[MM - 1]);
  for (int i = MM - 2; i >= 0; i--) {
    ifac[i] = ((i + 1) * ifac[i + 1]) % mod;
  }
}
long long nCr(long long N, long long R, long long modx = mod) {
  if (R <= N && R >= 0) {
    return ((fac[N] * ifac[R]) % modx * ifac[N - R]) % modx;
  }
  return 0;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  preFac();
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    a[i]--;
  }
  sort(a.begin(), a.end());
  long long ans = 1;
  int cur = -1;
  vector<int> sz;
  for (int i = 1; i < m; i++) {
    sz.push_back(a[i] - a[i - 1] - 1);
    if (a[i] == a[i - 1] + 1) {
      continue;
    }
    ans = (ans * powmod(2, sz.back() - 1)) % mod;
  }
  sz.push_back(a[0]);
  if (a[m - 1] != n - 1) {
    sz.push_back(n - 1 - a[m - 1]);
  }
  long long num = fac[n - m];
  long long ux = n - m;
  for (auto u : sz) {
    num = (num * ifac[u]) % mod;
    ux -= u;
  }
  assert(ux == 0);
  cout << (num * ans) % mod;
  return 0;
}
