#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
inline int read() {
  int x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
int a[1007], fac[1007] = {1}, p[1007] = {1}, len[1007];
inline int Fast_pow(int b, int p) {
  int ans = 1;
  while (p) {
    if (p & 1) ans = 1ll * ans * b % mod;
    b = 1ll * b * b % mod;
    p >>= 1;
  }
  return ans;
}
inline void init() {
  for (int i = 1; i <= 1000; ++i) fac[i] = 1ll * fac[i - 1] * i % mod;
  for (int i = 1; i <= 1000; ++i) p[i] = (p[i - 1] << 1) % mod;
}
int main() {
  init();
  int n = read(), m = read(), ans = 1, cnt = 0;
  for (int i = 1; i <= m; ++i) a[i] = read();
  sort(a + 1, a + m + 1);
  len[++cnt] = a[1] - 1;
  for (int i = 2; i <= m; ++i)
    if (a[i] - a[i - 1] > 1) len[++cnt] = a[i] - a[i - 1] - 1;
  len[++cnt] = n - a[m];
  for (int i = 1; i <= cnt; ++i) ans = 1ll * ans * fac[len[i]] % mod;
  ans = 1ll * Fast_pow(ans, mod - 2) * fac[n - m] % mod;
  for (int i = 2; i < cnt; ++i) ans = 1ll * ans * p[len[i] - 1] % mod;
  printf("%d\n", ans);
  return 0;
}
