#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  int f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -f;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (!x) putchar('0');
  if (x < 0) x = -x, putchar('-');
  static int sta[36];
  int tot = 0;
  while (x) sta[tot++] = x % 10, x /= 10;
  while (tot) putchar(sta[--tot] + 48);
}
const int inf = 0x3f3f3f3f;
const int maxn = 2e5 + 10;
const int mod = 1e9 + 7;
long long a[maxn], n, m;
long long pw[maxn], f[maxn];
vector<int> b;
void init() {
  memset(a, 0, sizeof(a));
  pw[0] = f[0] = 1;
  for (long long i = 1; i < maxn; i++) {
    pw[i] = (pw[i - 1] * 2) % mod;
    f[i] = (f[i - 1] * i) % mod;
  }
}
long long qpow(long long n, long long m) {
  long long ans = 1;
  while (m) {
    if (m & 1) ans = (ans * n) % mod;
    m >>= 1;
    n = (n * n) % mod;
  }
  return ans;
}
long long C(long long n, long long m) {
  long long a = f[n], b = (f[n - m] * f[m]) % mod;
  return (a * qpow(b, mod - 2)) % mod;
}
int main() {
  long long x;
  init();
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    a[x] = 1;
  }
  int j = 1, tot = 0;
  for (int i = 1; i <= n; i = j) {
    int cnt = 0;
    while (j <= n && a[j] == 0) j++, cnt++;
    j++, tot += cnt;
    if (cnt > 0) b.push_back(cnt);
  }
  long long ans = 1;
  for (int i = 0; i < b.size(); i++) {
    long long tmp = pw[b[i] - 1];
    if (i == 0 && a[1] == 0 || (i == b.size() - 1 && a[n] == 0)) tmp = 1;
    ans = (ans * (C(tot, b[i]) * tmp % mod)) % mod;
    tot -= b[i];
  }
  cout << ans << endl;
  return 0;
}
