#include <bits/stdc++.h>
using namespace std;
int N, M, T;
bool tb[1005];
long long Extend_EU(long long a, long long b, long long *x, long long *y) {
  if (b == 0) {
    *x = 1;
    *y = 0;
    return a;
  } else {
    long long q = a / b;
    long long r = a % b;
    long long u, v;
    long long d = Extend_EU(b, r, &u, &v);
    *x = v;
    *y = u - v * q;
    return d;
  }
}
long long inverse(long long a, long long p) {
  long long x, y;
  Extend_EU(a, p, &x, &y);
  return x % p;
}
int main() {
  int i, j, k;
  scanf("%d%d", &N, &M);
  for (i = 0; i < M; i++) {
    scanf("%d", &k);
    tb[k] = true;
  }
  vector<int> a, b;
  vector<int> sp;
  sp.push_back(0);
  sp.push_back(1);
  int mod = 1000000007;
  k = 1;
  for (i = 2; i <= N; i++) {
    k *= 2;
    k %= mod;
    sp.push_back(k);
  }
  int sum = 0;
  for (i = 1; i <= N; i++) {
    if (tb[i]) continue;
    j = i;
    while (tb[i] == 0 && i <= N) i++;
    k = i - j;
    if (tb[j - 1] && tb[i]) b.push_back(sp[k]);
    a.push_back(k);
    sum += k;
  }
  long long ans = 1, y = 1, z;
  for (i = 2; i <= sum; i++) ans *= i, ans %= mod;
  for (i = 0; i < a.size(); i++) {
    for (j = 2; j <= a[i]; j++) y *= j, y %= mod;
  }
  z = inverse(y, mod);
  z += mod;
  z %= mod;
  ans *= z;
  ans %= mod;
  for (i = 0; i < b.size(); i++) ans *= b[i], ans %= mod;
  cout << ans << endl;
}
