#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int ans = 1;
vector<int> a(1);
int n, m;
int main() {
  cin >> n >> m;
  a.resize(m);
  int x, one, two, r = 1;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (i != 0 && a[i] - 1 == a[i - 1]) {
      ans = 0;
      cout << ans << endl;
      return 0;
    } else if (i != 0) {
      x = a[i] - a[i - 1];
      two = x / 2;
      one = x % 2;
      for (int j = 2; i <= two + one; i++) {
        r *= j;
      }
      ans *= r;
    }
  }
  if (a[m - 1] < n - 2) {
    x = n - a[m - 1];
    two = x / 2;
    one = x % 2;
    for (int i = 2; i <= two + one; i++) {
      r *= i;
    }
    ans *= r;
  }
  ans %= mod;
  cout << ans << endl;
}
