#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000000 + 7;
long long BigMod(long long x, long long n) {
  if (x == 0) return 1 % mod;
  if (n <= 0) return 1 % mod;
  if (n == 1) return x % mod;
  long long ret = BigMod(x, n / 2);
  ret = (ret * ret) % mod;
  if (n % 2 != 0) ret = (ret * x) % mod;
  return ret;
}
long long fact[1010];
void precalc() {
  fact[0] = 1 % mod;
  for (int i = 1; i < 1010; i++) fact[i] = (fact[i - 1] * i) % mod;
}
vector<long long> parts;
long long n;
long long a[1010];
int main() {
  long long sum, ans, sz;
  precalc();
  cin >> n;
  long long m;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  sum = 0;
  sum += a[0] - 1;
  sum += n - a[m - 1];
  ans = 1;
  ans = (ans * BigMod(fact[a[0] - 1], mod - 2)) % mod;
  ans = (ans * BigMod(fact[n - a[m - 1]], mod - 2)) % mod;
  for (int i = 1; i < m; i++) {
    if (a[i] == a[i - 1] + 1) continue;
    sz = a[i] - a[i - 1] - 1;
    ans = (ans * BigMod(fact[sz], mod - 2)) % mod;
    ans = (ans * BigMod(2, sz - 1)) % mod;
    sum += sz;
  }
  ans = (ans * fact[sum]) % mod;
  cout << ans % mod << endl;
  return 0;
}
