#include <bits/stdc++.h>
using namespace std;
long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
long long nCr(int n, int r) {
  long long ans = 1;
  for (int i = n; i > n - r; i--) {
    ans = ans * i;
    ans %= 1000000007;
  }
  for (long long i = 1; i < r + 1; i++) {
    ans *= modinv(i, 1000000007);
    ans %= 1000000007;
  }
  return ans;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < M; i++) cin >> A.at(i);
  long long ans = 1;
  int now = 0;
  for (int i = 0; i < M + 1; i++) {
    long long tmp_ans = 0;
    int num_step;
    if (i < M)
      num_step = A.at(i) - 1 - now;
    else
      num_step = N - now;
    for (int j = 0; j <= num_step / 2; j++) {
      int num_2 = j;
      int num = num_step - num_2;
      tmp_ans += nCr(num, num_2);
      tmp_ans %= 1000000007;
    }
    if (num_step < 0) tmp_ans = 0;
    ans *= tmp_ans;
    ans %= 1000000007;
    if (i < M) now = A.at(i) + 1;
  }
  cout << ans << endl;
}
