#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
    n >>= 1;
  }
  return res;
}
long long ncr(long long n, long long r) {
  if (r < 0) return 0;
  if (n < r) return 0;
  if (n - r < r) return ncr(n, n - r);
  long long res = 1;
  for (long long(i) = 0; (i) < (r); (i)++) {
    res = res * (n - i) % 1000000007;
    res = res * modpow(r - i, 1000000007 - 2) % 1000000007;
  }
  return res;
}
int main() {
  long long n, m;
  cin >> n >> m;
  long long a1 = -1;
  long long a2 = -1;
  long long ans = 1;
  for (long long(i) = 0; (i) < (m + 1); (i)++) {
    a1 = a2;
    if (i != m)
      cin >> a2;
    else
      a2 = n + 1;
    if (a1 == a2) ans = 0;
    long long k = a2 - a1 - 2;
    long long r = 0;
    long long ans0 = 0;
    while (k >= r) {
      ans0 += ncr(k, r) % 1000000007;
      k -= 1;
      r += 1;
    }
    ans = ans * ans0 % 1000000007;
  }
  cout << ans << endl;
}
