#include <bits/stdc++.h>
using namespace std;
long long memo[100001];
long long fract(long long num) {
  if (num == 1 || num == 0) return 1;
  if (memo[num] == -1) memo[num] = (num * fract(num - 1)) % 1000000007;
  return memo[num];
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> as;
  for (int i = 0; i < 100001; i++) {
    memo[i] = -1;
  }
  for (int i = 0; i < m; i++) {
    int t;
    cin >> t;
    as.push_back(t);
  }
  for (int i = 1; i < m; i++) {
    if (as[i] - 1 == as[i - 1]) {
      cout << 0 << endl;
      return 0;
    }
  }
  int start = 0;
  long long ccnt = 1;
  for (int i = 0; i < m + 1; i++) {
    int sub = i < m ? as[i] - start - 1 : n - start;
    start = as[i] + 1;
    long long sum = 1;
    if (sub % 2 == 0) {
      for (int j = 1; j <= sub / 2; j++) {
        sum +=
            fract(sub - j) * modinv(fract(j) * fract(sub - j * 2), 1000000007);
        sum %= 1000000007;
      }
    } else {
      for (int j = 1; j <= (sub - 1) / 2; j++) {
        sum +=
            fract(sub - j) * modinv(fract(j) * fract(sub - j * 2), 1000000007);
        sum %= 1000000007;
      }
    }
    ccnt = (ccnt * sum) % 1000000007;
  }
  cout << ccnt << endl;
  return 0;
}
