#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int modpow(int b, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) {
      ans = (1ll * ans * b) % mod;
    }
    p >>= 1;
    b = (1ll * b * b) % mod;
  }
  return ans;
}
int fact[1005];
void pre() {
  fact[0] = 1;
  for (int i = 1; i < 1005; i++) {
    fact[i] = (1ll * i * fact[i - 1]) % mod;
  }
  return;
}
int main() {
  pre();
  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());
  int ans = modpow(fact[a[0]], mod - 2);
  for (int i = 1; i < a.size(); i++) {
    int seg = a[i] - a[i - 1] - 1;
    if (!seg) {
      continue;
    }
    ans = (1ll * ans * modpow(fact[seg], mod - 2)) % mod;
    ans = (1ll * ans * modpow(2, seg - 1)) % mod;
  }
  ans = (1ll * ans * modpow(fact[n - 1 - a.back()], mod - 2)) % mod;
  ans = (1ll * ans * fact[(n - a.size())]) % mod;
  cout << ans << endl;
  return 0;
}
