#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
const int mod = 1e9 + 7;
int n, m, C[MAXN][MAXN], a[MAXN];
int fastpow(register int a, register int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % mod;
    b >>= 1, a = 1ll * a * a % mod;
  }
  return ret;
}
void init() {
  C[0][0] = 1;
  for (register int i = 1; i < MAXN; ++i) {
    C[i][0] = C[i][i] = 1;
    for (register int j = 1; j < i; ++j) {
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
    }
  }
}
void work() {
  scanf("%d%d", &n, &m);
  for (register int i = 1; i <= m; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + m + 1);
  int num = n - m, ans = C[num][a[1] - 1];
  num -= a[1] - 1;
  for (register int i = 2; i <= m; ++i) {
    int len = a[i] - a[i - 1] - 1;
    if (len)
      ans = 1ll * ans * C[num][len] % mod * fastpow(2, len - 1) % mod;
    else
      ans = 1ll * ans * C[num][len] % mod;
    num -= len;
  }
  ans = 1ll * ans * C[num][n - a[m]] % mod;
  printf("%d\n", ans);
}
int main() {
  int _ = 1;
  init();
  while (_--) {
    work();
  }
  return 0;
}
