#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%lld", &x);
  return x;
}
const long long maxn = 1e3 + 10;
long long q[maxn], t;
const long long mod = 1e9 + 7;
long long pw[maxn];
long long c[maxn][maxn];
int32_t main() {
  long long n = in(), m = in();
  for (long long i = 0; i < m; i++) q[t++] = in();
  for (long long i = 0; i < maxn; i++)
    for (long long j = 0; j <= i; j++)
      c[i][j] = i == j ? 1 : (c[i - 1][j - 1] + c[i - 1][j]) % mod;
  pw[0] = 1;
  for (long long i = 1; i < maxn; i++) pw[i] = pw[i - 1] * 2 % mod;
  sort(q, q + t);
  long long res = 1;
  long long rem = n - m;
  for (long long i = 1; i < t; i++) {
    (res *= pw[q[i] - q[i - 1] - 2]) %= mod;
    (res *= c[rem][q[i] - q[i - 1] - 1]) %= mod;
    rem -= q[i] - q[i - 1] - 1;
  }
  (res *= c[rem][q[0] - 1]) %= mod;
  rem -= q[0] - 1;
  cout << res << endl;
}
