#include <bits/stdc++.h>
long long int fac[100000], finv[100000], inv[100000];
void MOD_COM_init() {
  fac[0] = 1;
  fac[1] = 1;
  finv[0] = 1;
  finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < 100000; i++) {
    fac[i] = fac[i - 1] * i % 1000000007;
    inv[i] = 1000000007 - inv[1000000007 % i] * (1000000007 / i) % 1000000007;
    finv[i] = finv[i - 1] * inv[i] % 1000000007;
  }
}
long long int MOD_combination(long long int n, long long int r) {
  if (r < 0 || n < 0) {
    return 0;
  }
  if (n < r) {
    return 0;
  }
  return (fac[n] * (finv[r] * finv[n - r] % 1000000007)) % 1000000007;
}
int main() {
  long long int n, m;
  scanf("%lld%lld", &n, &m);
  long long int a[m + 2];
  a[0] = -1;
  a[m + 1] = n + 1;
  for (long long int i = 1; i <= m; i++) {
    scanf("%lld", &a[i]);
  }
  long long int ans = 1;
  MOD_COM_init();
  for (long long int i = 1; i <= m + 1; i++) {
    long long int w = (a[i] - 1) - (a[i - 1] + 1);
    long long int buf = 0;
    for (long long int j = 0; j <= w; j++) {
      buf += MOD_combination(w, j);
      buf = buf % 1000000007;
      w--;
    }
    ans *= buf;
    ans = ans % 1000000007;
  }
  printf("%lld", ans);
  return 0;
}
