#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int INF = 1e9;
const long long LLINF = 1e16;
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) {
  long long n, m;
  cin >> n >> m;
  vector<long long> a(m);
  vector<long long> range(m + 1);
  long long mod = 1e9 + 7;
  for (long long i = 0, i_len = (m); i < i_len; ++i) {
    cin >> a[i];
  }
  range[0] = a[0] - 1;
  range[m] = n - a[m - 1] - 1;
  for (long long i = 0, i_len = (m - 1); i < i_len; ++i) {
    if (a[i + 1] - a[i] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (long long i = 1, i_len = (m); i < i_len; ++i) {
    range[i] = a[i] - a[i - 1] - 2;
  }
  long long max = *max_element((range).begin(), (range).end());
  vector<long long> mod_kaijo(max + 1);
  mod_kaijo[0] = 1;
  for (long long i = 1, i_len = (max + 1); i < i_len; ++i) {
    mod_kaijo[i] = ((i % mod) * mod_kaijo[i - 1]) % mod;
  }
  long long ans = 1;
  for (long long i = 0, i_len = (range.size()); i < i_len; ++i) {
    long long sum = 0;
    for (long long j = 0; j <= range[i] / 2; j++) {
      sum = (sum +
             (mod_kaijo[range[i] - j] *
              modinv((mod_kaijo[range[i] - 2 * j] * mod_kaijo[j]) % mod, mod)) %
                 mod) %
            mod;
    }
    ans = (ans * sum) % mod;
  }
  cout << ans << endl;
  return 0;
}
