#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxn = 1e5 + 10;
int a[maxn];
long long f[maxn];
long long ni[maxn];
long long qpow(long long x, long long n) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * x % mod;
    x = x * x % mod;
    n >>= 1;
  }
  return ans;
}
void init() {
  f[0] = ni[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    f[i] = f[i - 1] * i % mod;
    ni[i] = qpow(f[i], mod - 2);
  }
}
int main() {
  int n, m;
  init();
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) cin >> a[i];
  sort(a + 1, a + 1 + m);
  if (m == 0 || n == m)
    cout << 1 << endl;
  else if (m == 1) {
    long long ans = f[n - m];
    ans = ans * ni[a[1] - 1] % mod * ni[n - a[1]] % mod;
    cout << ans << endl;
  } else {
    int len = 0;
    long long ans = f[n - m];
    for (int i = 2; i <= m; ++i) {
      int k = a[i] - a[i - 1] - 2;
      if (k > 0) len += k;
    }
    ans = ans * qpow(2, len) % mod;
    for (int i = 2; i <= m; ++i) {
      int k = a[i] - a[i - 1] - 1;
      if (k > 0) ans = ans * ni[k] % mod;
    }
    ans = ans * ni[a[1] - 1] % mod * ni[n - a[m]] % mod;
    cout << ans << endl;
  }
  return 0;
}
