#include <bits/stdc++.h>
using namespace std;
int64_t NC(int A, vector<int64_t>& memo) {
  if (A < 0) {
    return 0;
  }
  if (memo[A] != -1) return memo[A];
  if (A < 2) {
    memo[A] = 1;
    return memo[A];
  }
  if (A == 2) {
    memo[A] = 2;
    return memo[A];
  }
  memo[A] = NC(A - 1, memo) + NC(A - 2, memo);
  return memo[A];
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int64_t> memo(400000, -1);
  vector<int> broken(M);
  for (int i = 0; i < M; i++) {
    cin >> broken.at(i);
  }
  int64_t ans = 1;
  ans *= NC(broken.at(0) - 1, memo) % 1000000007;
  ans *= NC(N - broken.at(M - 1) - 1, memo) % 1000000007;
  for (int i = 0; i < M - 1; i++) {
    ans *= NC(broken.at(i + 1) - broken.at(i) - 2, memo) % 1000000007;
    ans %= 1000000007;
  }
  cout << ans << endl;
}
