#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  while (a && b) a > b ? a %= b : b %= a;
  return a + b;
}
int LCM(int a, int b) { return (a * b) / gcd(a, b); }
long long fast_exp(long long base, long long exp) {
  long long res = 1;
  while (exp > 0) {
    if (exp % 2 == 1)
      res = ((res % 1000000007) * (base % 1000000007)) % 1000000007;
    base = ((base % 1000000007) * (base % 1000000007)) % 1000000007;
    exp /= 2;
  }
  return res % 1000000007;
}
int phi(int n) {
  int result = n;
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) {
      while (n % i == 0) n /= i;
      result -= result / i;
    }
  if (n > 1) result -= result / n;
  return result;
}
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
long long nCr[1009][1009];
long long pow1[1009];
void init() {
  int i = 1;
  pow1[0] = 1;
  for (i = 1; i < 1009; i++) {
    pow1[i] = ((pow1[i - 1] % 1000000007) * (2 % 1000000007)) % 1000000007;
  }
  for (i = 0; i < 1009; i++) {
    nCr[i][0] = 1;
    nCr[i][i] = 1;
  }
  for (i = 2; i < 1009; i++) {
    for (int j = 1; j < 1009; j++) {
      nCr[i][j] =
          (nCr[i - 1][j - 1] % 1000000007 + nCr[i - 1][j] % 1000000007) %
          1000000007;
    }
  }
}
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  init();
  int m, n;
  cin >> m >> n;
  int A[n];
  for (int(i) = 0; (i) < (n); (i)++) {
    cin >> A[i];
  }
  sort(A, A + n);
  long long cnt = 0, ans = 1;
  cnt += A[0] - 1;
  for (int(i) = 1; (i) <= (n - 1); (i)++) {
    long long temp = A[i] - A[i - 1] - 1;
    if (temp <= 0) continue;
    ans = ((ans % 1000000007) * (pow1[temp - 1] % 1000000007)) % 1000000007;
    cnt += temp;
    ans = ((ans % 1000000007) * (nCr[cnt][temp] % 1000000007)) % 1000000007;
  }
  cnt += m - A[n - 1];
  if (m - A[n - 1])
    ans = ((ans % 1000000007) * (nCr[cnt][m - A[n - 1]] % 1000000007)) %
          1000000007;
  cout << ans << '\n';
  return 0;
}
