#include <bits/stdc++.h>
using namespace std;
int const MOD = 1000000007;
long long Pow(long long base, long long pow) {
  if (pow == 0) return 1;
  if (pow % 2)
    return (base * Pow((base * base) % MOD, pow / 2)) % MOD;
  else
    return Pow((base * base) % MOD, pow / 2);
}
long long fact[1009];
int main() {
  fact[0] = fact[1] = 1;
  for (int i = 2; i < 1009; i++) fact[i] = (fact[i - 1] * i) % MOD;
  int n, m;
  scanf("%d%d", &n, &m);
  long long dots = n - m, twos = 0, mkm = 1;
  vector<int> v(m);
  for (int i = 0; i < m; i++) scanf("%d", &v[i]);
  v.push_back(0);
  v.push_back(n + 1);
  sort(v.begin(), v.end());
  for (int i = 2; i < (int)v.size() - 1; ++i) {
    long long dotS = (v[i] - v[i - 1] - 1);
    twos += max(0LL, dotS - 1);
    mkm = (mkm * fact[dotS]) % MOD;
  }
  mkm = (mkm * fact[v[1] - v[0] - 1]) % MOD;
  mkm = (mkm * fact[v[(int)v.size() - 1] - v[(int)v.size() - 2] - 1]) % MOD;
  twos = Pow(2, twos);
  dots = (fact[dots] * twos) % MOD;
  cout << (Pow(mkm, MOD - 2) * dots) % MOD << endl;
  return 0;
}
