#include <bits/stdc++.h>
using namespace std;
const int N = 1010, p = 1e9 + 7;
int n, m, a[N], cnt, c[N][N], sz[N], sum[N];
int power(int a, int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % p;
    a = 1ll * a * a % p;
    b >>= 1;
  }
  return ret;
}
int add(int a, int b) { return ((a + b) % p + p) % p; }
void pre() {
  c[0][0] = 1;
  for (int i = 1; i <= 1000; i++) c[i][0] = 1, c[0][i] = 0;
  for (int i = 1; i <= 1000; i++)
    for (int j = 1; j <= 1000; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % p;
  return;
}
int main() {
  int ans = 1;
  scanf("%d", &n);
  ;
  scanf("%d", &m);
  ;
  pre();
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  ;
  sort(a + 1, a + m + 1);
  a[0] = 0;
  a[m + 1] = n + 1;
  for (int i = 1; i <= m + 1; i++) {
    sz[++cnt] = a[i] - a[i - 1] - 1, sum[cnt] = sum[cnt - 1] + sz[cnt];
    ans = 1ll * ans * c[n - m - sum[cnt - 1]][sz[cnt]] % p;
    if (sz[cnt] > 0 && i != 1 && i != m + 1)
      ans = 1ll * ans * power(2, sz[cnt] - 1) % p;
  }
  printf("%d\n", ans);
  return 0;
}
