#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, m, i, j, p[1002], l[1002], c[1002][1002];
long long read() {
  char c = getchar();
  long long w = 0;
  while (c < '0' || c > '9') c = getchar();
  while (c <= '9' && c >= '0') {
    w = w * 10 + c - '0';
    c = getchar();
  }
  return w;
}
long long poww(long long a, long long b) {
  long long ans = 1, base = a;
  while (b) {
    if (b & 1) ans = ans * base % mod;
    base = base * base % mod;
    b >>= 1;
  }
  return ans;
}
signed main() {
  n = read();
  m = read();
  for (i = 1; i <= m; i++) p[i] = read();
  sort(p + 1, p + m + 1);
  p[++m] = n + 1;
  for (i = 1; i <= m; i++) l[i] = p[i] - p[i - 1] - 1;
  c[0][0] = 1;
  for (i = 1; i <= n; i++) {
    c[i][0] = 1;
    for (j = 1; j <= n; j++) c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % mod;
  }
  long long sum = l[1], ans = c[n - m + 1][l[1]];
  for (i = 2; i < m; i++) {
    if (l[i])
      ans = ans * c[n - m + 1 - sum][l[i]] % mod * poww(2, l[i] - 1) % mod;
    sum += l[i];
  }
  ans = ans * c[n - m + 1 - sum][l[m]] % mod;
  printf("%lld\n", ans);
  return 0;
}
