#include <bits/stdc++.h>
using namespace std;
void mmin(long long &a, long long b) { a = min(a, b); }
void mmax(long long &a, long long b) { a = max(a, b); }
long long vsum(vector<long long> v) {
  return accumulate(v.begin(), v.end(), 0);
}
long long msum(vector<vector<long long> > v) {
  long long ans = 0;
  for (long long i = 0; i < v.size(); i++) {
    ans += vsum(v[i]);
  }
  return ans;
}
long long fac(long long x) {
  long long res = 1;
  for (long long i = 0; i < x; i++) {
    res *= i + 1;
  }
  return res;
}
long long pat(long long x) {
  long long res = 0;
  if ((x % 2) == 0) {
    for (long long i = 0; i < (x / 2 + 1); i++) {
      long long n = i * 2;
      long long m = (x - n) / 2;
      res += fac(n + m) / (fac(n) * fac(m));
    }
    return res;
  } else {
    for (long long i = 0; i < (x / 2 + 1); i++) {
      long long n = i * 2 + 1;
      long long m = (x - n) / 2;
      res += fac(n + m) / (fac(n) * fac(m));
    }
    return res;
  }
}
signed main() {
  long long pr = 1000;
  pr *= pr * pr;
  pr += 7;
  long long N, M;
  cin >> N;
  cin >> M;
  vector<long long> a(M);
  for (long long i = 0; i < M; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < N - 1; i++) {
    if (a[i + 1] - a[i] == 1) {
      cout << 0;
      return 0;
    }
  }
  long long j = 0;
  long long res = 1;
  for (long long i = 0; i < M + 1; i++) {
    long long temp;
    if (i == M) {
      temp = N + 1;
    } else {
      temp = a[i];
    }
    res = ((res % pr) * (pat(temp - 1 - j) % pr)) % pr;
    j = temp + 1;
  }
  cout << res;
  return 0;
}
