#include <bits/stdc++.h>
using namespace std;
long long modinv(long long a) {
  long long b = 1000000007, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= 1000000007;
  if (u < 0) u += 1000000007;
  return u;
}
long long comb(long long n, long long m) {
  long long o = 1;
  for (int i = 0; i < m; i++)
    o = o * (n - i) % 1000000007 * modinv(i + 1) % 1000000007;
  return o;
}
int main() {
  long long n, m, o = 1, r, t;
  cin >> n >> m;
  vector<long long> a(m), c;
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
    if (i)
      r = a.at(i) - a.at(i - 1) - 2;
    else
      r = a.at(i) - 1;
    if (r < 0)
      o = -1;
    else if (r > 1) {
      t = 0;
      for (int j = 0; j <= r / 2; j++) t = (t + comb(r - j, j)) % 1000000007;
      c.push_back(t);
    }
    if (i == m - 1) {
      r = n - a.at(i) - 1;
      t = 0;
      for (int j = 0; j <= r / 2; j++) t = (t + comb(r - j, j)) % 1000000007;
      c.push_back(t);
    }
  }
  if (o == -1)
    cout << 0 << endl;
  else {
    for (int i = 0; i < c.size(); i++) o = o * c.at(i) % 1000000007;
    cout << o << endl;
  }
}
