#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000;
const int MOD = 1000000007;
int as[MAX_N], ds[MAX_N];
int fs[MAX_N + 1], invfs[MAX_N + 1], es[MAX_N + 1];
int powmod(int a, int n) {
  int pm = 1;
  while (n > 0) {
    if (n & 1) pm = (long long)pm * a % MOD;
    a = (long long)a * a % MOD;
    n >>= 1;
  }
  return pm;
}
inline int nck(int n, int k) {
  return (long long)fs[n] * invfs[n - k] % MOD * invfs[k] % MOD;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", as + i);
  sort(as, as + m);
  fs[0] = invfs[0] = es[0] = 1;
  for (int i = 1; i <= n; i++) {
    fs[i] = (long long)fs[i - 1] * i % MOD;
    invfs[i] = powmod(fs[i], MOD - 2);
    es[i] = es[i - 1] * 2 % MOD;
  }
  int k = 0, dsum = 0;
  for (int i = 0, pa = 0; i < m; i++, k++) {
    ds[k] = as[i] - pa - 1;
    dsum += ds[k];
    pa = as[i];
  }
  ds[k] = n - as[m - 1];
  dsum += ds[k];
  k++;
  int p = 1;
  for (int i = 0; i < k; i++) {
    int e = (i > 0 && i < k - 1 && ds[i] > 1) ? es[ds[i] - 1] : 1;
    p = (long long)p * nck(dsum, ds[i]) % MOD * e % MOD;
    dsum -= ds[i];
  }
  printf("%d\n", p);
  return 0;
}
