#include <bits/stdc++.h>
using namespace std;
const long long INTEG = pow(10, 9) + 7;
long long fctrl(int a) {
  long long ret = 1;
  for (int i = 2; i <= a; i++) {
    ret *= i;
  }
  return ret;
}
long long ways(int step) {
  long long ret = 0;
  int a = step / 2 + 1;
  for (int i = 0; i < a; i++) {
    int x = step - 2 * i;
    ret += (fctrl(x + i) / fctrl(x) / fctrl(i)) % INTEG;
  }
  return ret;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  for (int &i : a) cin >> i;
  unique(a.begin(), a.end());
  a.insert(a.begin(), -1);
  a.push_back(N + 1);
  vector<int> difs;
  for (int i = 0; i < a.size() - 1; i++) {
    int dif = a[i + 1] - a[i] - 2;
    if (dif < 0) {
      cout << 0 << endl;
      return 0;
    }
    if (dif >= 1) difs.push_back(dif);
  }
  if (difs.size() == 0) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 1;
  for (int &d : difs) {
    ans = (ans * ways(d)) % INTEG;
  }
  cout << ans << endl;
}
