#include <bits/stdc++.h>
using namespace std;
const int maxN = 11111;
bool isPr[maxN];
long long P[maxN], REP[maxN], ans, dp, n, m, a[maxN];
int main() {
  cin >> n >> m;
  for (int i = 1; i <= m; i++) cin >> a[i];
  sort(a + 1, a + m + 1);
  for (int i = 1; i <= m - 1; i++) ans += a[i + 1] - a[i] - 1;
  ans += a[1] - 1 + n - a[m];
  memset(isPr, true, sizeof(isPr));
  isPr[1] = false;
  int o = 0;
  for (int i = 2; i <= n; i++)
    if (isPr[i]) {
      int j = 2;
      P[++o] = i;
      while (i * j <= n) {
        isPr[i * j] = false;
        j++;
      }
    }
  int st;
  a[0] = 0;
  a[++m] = n + 1;
  for (int i = 2; i <= ans; i++) {
    int tmp = i;
    st = 1;
    while (tmp >= P[st]) {
      while (tmp % P[st] == 0) {
        REP[P[st]]++;
        tmp /= P[st];
      }
      if (isPr[tmp]) {
        REP[tmp]++;
        break;
      }
      st++;
    }
  }
  for (int i = 0; i <= m - 1; i++) {
    dp = a[i + 1] - a[i] - 1;
    for (int j = 2; j <= dp; j++) {
      int tmp = j;
      st = 1;
      while (tmp > 1) {
        while (tmp % P[st] == 0) {
          REP[P[st]]--;
          tmp /= P[st];
        }
        if (isPr[tmp]) {
          REP[tmp]--;
          break;
        }
        st++;
      }
    }
  }
  for (int i = 1; i <= m - 2; i++) {
    dp = a[i + 1] - a[i] - 1;
    if (dp != 0) REP[2] += dp - 1;
  }
  long long res = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= REP[i]; j++) res = (res * (long long)i) % 1000000007;
  cout << res << endl;
}
