#include <bits/stdc++.h>
using namespace std;
const long long mo = 1e9 + 7;
const long long N = 1e3 + 10;
long long n, m, cnt, s[N];
bool b[N];
void init() {
  s[0] = 1;
  for (long long i = 1; i <= 1000; i++) s[i] = s[i - 1] * i % mo;
}
long long Pow(long long x, long long n, long long p) {
  long long ans = 1;
  while (n) {
    if (n & 1) ans = ans * x % mo;
    x = x * x % mo;
    n >>= 1;
  }
  return ans % mo;
}
long long inv(long long x) { return Pow(x, mo - 2, mo); }
long long C(long long n, long long m) {
  return s[n] * inv(s[m]) % mo * inv(s[n - m]) % mo;
}
signed main() {
  init();
  scanf("%lld%lld", &n, &m);
  memset(b, false, sizeof(b));
  for (long long i = 1; i <= m; i++) {
    long long t;
    scanf("%lld", &t);
    b[t] = 1;
  }
  for (long long i = 1; i <= n; i++) {
    if (b[i]) continue;
    long long j = i;
    while (j <= n && !b[j]) j++;
    cnt += j - i;
    i = j - 1;
  }
  long long ans = 1;
  for (long long i = 1; i <= n; i++) {
    if (b[i]) continue;
    long long j = i;
    while (j <= n && !b[j]) j++;
    if (i == 1)
      ans = ans * C(cnt, j - i) % mo;
    else if (j - 1 == n)
      ans = ans * C(cnt, j - i) % mo;
    else
      ans = ans * C(cnt, j - i) % mo * Pow(2, j - i - 1, mo) % mo;
    cnt -= j - i;
    i = j - 1;
  }
  printf("%lld\n", ans);
  return 0;
}
