#include <bits/stdc++.h>
using namespace std;
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() {
  long long n, m;
  long long a[1000000];
  long long step1, step2;
  long long count = 0;
  long long ans = 1;
  long long checks2;
  cin >> n >> m;
  long long x, y, z;
  long long mod = 1000000007;
  for (int i = 1; i < m + 1; i++) {
    cin >> a[i];
  }
  a[m + 1] = n;
  for (int i = 1; i <= m + 1; i++) {
    count = 0;
    if (a[i] == n) {
      step2 = (a[i] - a[i - 1]) / 2;
      if ((a[i] - a[i - 1]) % 2) {
        step1 = 1;
      } else {
        step1 = 0;
      }
    } else {
      step2 = (a[i] - a[i - 1] - 1) / 2;
      if ((a[i] - a[i - 1] - 1) % 2) {
        step1 = 1;
      } else {
        step1 = 0;
      }
    }
    cout << "step2 " << step2 << endl;
    if (step2 == 0 && a[i] != n && a[i - 1] != 0) {
      cout << 0 << endl;
      return 0;
    } else if (step2 == 0) {
      ans++;
      continue;
    }
    for (; step2 >= 0; step2--) {
      cout << "count " << count << endl;
      x = 1;
      y = 1;
      z = 1;
      checks2 = step1 + step2;
      for (long long k = 1; k <= checks2; k++) {
        x = x * k % mod;
        if (k <= step1) {
          y = y * k % mod;
        }
        if (k <= step2) {
          z = z * k % mod;
        }
      }
      count = (count + x * modinv(y, mod) % mod * modinv(z, mod) % mod) % mod;
      step1 += 2;
    }
    cout << x << " " << y << " " << z << endl;
    cout << count << endl;
    ans = ans * count % mod;
  }
  cout << ans << endl;
  return 0;
}
