#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
bool on[1005];
int arr[1005];
bool primo[1005];
int sz, n;
void criba() {
  memset(primo, 1, sizeof primo);
  primo[0] = 0;
  primo[1] = 0;
  for (int i = 2; i * i < 1005; i++) {
    if (primo[i])
      for (int j = i * i; j < 1005; j += i) primo[j] = 0;
  }
}
void llenar_arr() {
  bool tmp = on[0];
  int last;
  if (!tmp) {
    arr[0] = 1;
    last = 0;
  } else {
    arr[0] = 0;
    last = -1;
  }
  for (int i = (int)1; i < (int)n; i++) {
    if (!tmp and !on[i])
      arr[last]++;
    else if (tmp and !on[i]) {
      tmp = 0;
      arr[++last] = 1;
    } else if (!tmp and on[i]) {
      tmp = 1;
    }
  }
  sz = last + 1;
}
long long pot(long long a, int n) {
  if (n == 0) return 1;
  if (n == 1) return a % MOD;
  if (n % 2) return (a * pot(a, n - 1)) % MOD;
  long long aux = pot(a, n / 2);
  return (aux * aux) % MOD;
}
int expn(long long n, int p) {
  int ans = 0, aux = n / p;
  long long pot = p;
  while (aux != 0) {
    ans += aux;
    pot *= p;
    aux = n / pot;
  }
  return ans;
}
long long multinomial() {
  long long ans = 1;
  int ex, sum = 0;
  for (int i = 0; i < (int)sz; i++) sum += arr[i];
  for (int p = 0; p < (int)1001; p++)
    if (primo[p]) {
      ex = expn(sum, p);
      for (int i = 0; i < (int)sz; i++) {
        ex = ex - expn(arr[i], p);
      }
      ans = (ans * pot(p, ex)) % MOD;
    }
  return ans;
}
int main() {
  int t, aux;
  scanf("%d %d", &n, &t);
  memset(on, 0, sizeof on);
  for (int i = 0; i < (int)t; i++) {
    scanf("%d", &aux);
    on[aux - 1] = 1;
  }
  llenar_arr();
  criba();
  long long ans = multinomial();
  for (int i = (int)1; i < (int)sz - 1; i++) {
    ans = (ans * pot(2, arr[i] - 1)) % MOD;
  }
  if (sz == 0)
    ans = 1;
  else if (sz == 1) {
    if (on[0] and on[n - 1])
      ans = pot(2, arr[0] - 1);
    else if (!on[0] and !on[n - 1])
      ans = 0;
    else
      ans = 1;
  } else {
    if (on[0]) ans = (ans * pot(2, arr[0] - 1)) % MOD;
    if (on[n - 1]) ans = (ans * pot(2, arr[sz - 1] - 1)) % MOD;
  }
  cout << ans << endl;
}
