#include <bits/stdc++.h>
using namespace std;
int b[10005];
int a[1005];
int c[1005];
int prime[1100];
int flag[1100];
int ans[1005];
void init() {
  memset(flag, 0, sizeof(flag));
  int q = 0;
  for (int i = 2; i < 1100; i++) {
    if (!flag[i]) {
      prime[q++] = i;
      for (int j = i + i; j < 1100; j += i) flag[j] = 1;
    }
  }
}
void fun1(int k) {
  for (int i = 0; k >= prime[i]; i++) {
    int j = prime[i];
    int num = 0;
    while (k >= j) {
      num += k / j;
      j *= prime[i];
    }
    a[prime[i]] += num;
  }
}
void fun2(int k) {
  for (int i = 0; k >= prime[i]; i++) {
    int j = prime[i];
    int num = 0;
    while (k >= j) {
      num += k / j;
      j *= prime[i];
    }
    c[prime[i]] += num;
  }
}
long long Pow(int x, int y) {
  if (y == 0) return 1;
  long long mid = (long long)x;
  while (y > 1) {
    mid = (mid * x) % 1000000007;
    y--;
  }
  return mid % 1000000007;
}
int main() {
  int m, n;
  int t, i, j, k, l;
  int num;
  init();
  while (cin >> n >> k) {
    memset(a, 0, sizeof(a));
    memset(c, 0, sizeof(c));
    for (i = 0; i < k; i++) cin >> b[i];
    if (n == k) {
      cout << "1" << endl;
      continue;
    }
    sort(b, b + k);
    fun1(n - k);
    if (b[0] > 2) fun2(b[0] - 1);
    if (b[k - 1] < n - 1) fun2(n - b[k - 1]);
    for (i = 1; i < k; i++) {
      int mid = b[i] - b[i - 1] - 1;
      if (mid <= 1)
        continue;
      else {
        fun2(mid);
        a[2] += (mid - 1);
      }
    }
    for (i = 0; prime[i] <= n - k; i++) {
      ans[prime[i]] = a[prime[i]] - c[prime[i]];
    }
    long long re = 1;
    for (i = 0; prime[i] <= n - k; i++) {
      re = (re * Pow(prime[i], ans[prime[i]])) % 1000000007;
    }
    cout << re << endl;
  }
  return 0;
}
