#include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wsign-compare"
using namespace std;
const long long inf = 1e18 + 9;
const long long N = 200005;
const long long mod = 1e9 + 7;
long long n, m, k = 0, x, y, z, l, r, w, d, q, ct = 0, ans = 0, f = 0;
string s, p;
set<long long> si;
map<long long, long long> mi;
long long fact[100009];
long long powe(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = (res * x) % mod;
    y >>= 1;
    x = (x * x) % mod;
  }
  return res;
}
long long inv(long long h) { return powe(h, mod - 2); }
long long ncr(long long n, long long r) {
  if (!r) return 1;
  if (r < 0 || r > n) return 0;
  long long a, b, c, ans = 1;
  a = fact[n];
  b = inv(fact[n - r]);
  c = inv(fact[r]);
  ans = (a * b) % mod;
  ans = (ans * c) % mod;
  return ans;
}
signed main() {
  fact[0] = 1;
  for (long long i = 1; i <= 100000; i++) fact[i] = (fact[i - 1] * i) % mod;
  cin >> n >> m;
  long long a[m];
  for (long long i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  long long first = a[0] - 1;
  long long last = n - a[m - 1];
  vector<long long> poss;
  for (long long i = 1; i < m; i++)
    if (a[i] - a[i - 1] != 1) poss.push_back(a[i] - a[i - 1] - 1);
  ans = fact[n - m];
  ans *= powe(2, accumulate(poss.begin(), poss.end(), 0ll) - poss.size());
  ans %= mod;
  ans *= inv(fact[first]);
  ans %= mod;
  ans *= inv(fact[last]);
  ans %= mod;
  for (auto i : poss) {
    ans *= inv(fact[i]);
    ans %= mod;
  }
  cout << ans;
}
