#include <bits/stdc++.h>
using namespace std;
int n, m;
long long ans, mod = 1e9 + 7, a[1010], b[1010], c[1010], d[1010];
void exgcd(long long a, long long b, long long &x, long long &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return;
  }
  exgcd(b, a % b, y, x);
  y -= x * (a / b);
}
int C(int n, int m) {
  return ((b[n] * c[m] % mod + mod) % mod * c[n - m] % mod + mod) % mod;
}
int main() {
  scanf("%d%d", &n, &m);
  b[0] = c[0] = d[0] = 1;
  for (int i = 1; i <= m; i++) scanf("%lld", &a[i]);
  sort(a + 1, a + m + 1);
  for (int i = 1; i <= n; i++) b[i] = b[i - 1] * i % mod;
  for (int i = 1; i <= n; i++)
    exgcd(b[i], mod, c[i], ans), c[i] = (c[i] % mod + mod) % mod;
  for (int i = 1; i <= n; i++) d[i] = d[i - 1] * 2 % mod;
  n -= m;
  ans = C(n, a[1] - 1);
  n -= a[1] - 1;
  for (int i = 2; i <= m; i++) {
    int len = a[i] - a[i - 1] - 1;
    ans = (ans * C(n, len) % mod + mod) % mod;
    n -= len;
    if (len) ans = (ans * d[len - 1] % mod + mod) % mod;
  }
  printf("%lld\n", ans);
  return 0;
}
