#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
const signed N = 1005;
const int mod = 1e9 + 7;
long long a[N], b[N][N], vis[N];
inline void init() {
  for (long long i = 0; i <= 1000; i++) b[i][0] = 1;
  for (long long i = 1; i <= 1000; i++)
    for (long long j = 1; j <= 1000; j++)
      b[i][j] = (b[i - 1][j] + b[i - 1][j - 1]) % mod;
  vis[0] = 1;
  for (long long i = 1; i <= 1000; i++) vis[i] = (vis[i - 1] << 1) % mod;
}
signed main() {
  init();
  long long n, m;
  while (~scanf("%lld%lld", &m, &n)) {
    for (long long i = 1; i <= n; ++i) scanf("%lld", &a[i]);
    sort(a + 1, a + n + 1);
    long long x = m - n;
    long long egg = b[x][a[1] - 1];
    x -= a[1] - 1;
    for (long long i = 2; i <= n; i++) {
      long long tmp = a[i] - a[i - 1] - 1;
      if (tmp)
        egg = ((egg * b[x][tmp]) % mod * vis[tmp - 1]) % mod;
      else
        egg = (egg * b[x][tmp]) % mod;
      x -= tmp;
    }
    egg = (egg * b[x][m - a[n]]) % mod;
    printf("%lld\n", egg);
  }
  return 0;
}
