#include <bits/stdc++.h>
using namespace std;
const unsigned DIV = 1000000007;
unsigned long long combination(unsigned n, unsigned r) {
  unsigned long long ans = 1;
  for (unsigned i = n; i > n - r; i--) {
    ans *= i;
  }
  for (unsigned i = 1; i <= r; i++) {
    ans /= i;
  }
  return ans;
}
unsigned variation(unsigned step) {
  step--;
  if (step == 0 || step == 1) {
    return 1;
  }
  unsigned long long ans = 0;
  unsigned two = step / 2;
  for (unsigned t = 0; t <= two; t++) {
    unsigned o = step - (2 * t);
    ans += combination(o + t, o);
  }
  return ans % DIV;
}
int main() {
  unsigned n, m;
  cin >> n >> m;
  vector<unsigned> A(m);
  for (unsigned i = 0; i < m; i++) {
    cin >> A.at(i);
  }
  vector<unsigned> B(m - 1);
  for (unsigned i = 0; i < m - 1; i++) {
    unsigned diff = A.at(i + 1) - A.at(i) - 1;
    if (diff == 0) {
      cout << 0 << endl;
      return 0;
    }
    B.at(i) = diff;
  }
  B.push_back(A.at(0));
  B.push_back(n - A.at(A.size() - 1));
  unsigned long long ans = 1;
  for (unsigned b : B) {
    ans *= variation(b);
    ans %= DIV;
  }
  cout << ans << endl;
  return 0;
}
