#include <bits/stdc++.h>
using namespace std;
using uii = unsigned long long;
int comb[10001][10001];
constexpr int mod = 1000000007;
void init() {
  for (int i = 0; i < 10001; i++) {
    comb[i][0] = 1;
    comb[i][i] = 1;
  }
  for (int i = 1; i < 10001; i++) {
    for (int j = 1; j < i; j++) {
      comb[i][j] = (comb[i - 1][j - 1] % mod + comb[i - 1][j] % mod) % mod;
    }
  }
}
uii calc(int n) {
  uii ret = 0;
  int i = 0;
  n--;
  while (n >= i) {
    ret += comb[n][i] % mod;
    ret %= mod;
    n--;
    i++;
  }
  return ret;
}
int main() {
  int n, m;
  uii ans = 1;
  cin >> n >> m;
  vector<int> a(m);
  init();
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  ans *= calc(a[0]) % mod;
  for (int i = 1; i < m; i++) {
    ans *= calc(a[i] - a[i - 1] - 1) % mod;
    ans %= mod;
  }
  ans *= calc(n - a[m - 1]) % mod;
  ans %= mod;
  cout << ans << "\n";
  return 0;
}
