#include <bits/stdc++.h>
using namespace std;
long long k[1010], A[1010];
long long extgcd(long long a, long long b, long long& x, long long& y) {
  long long d, t;
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  d = extgcd(b, a % b, x, y);
  t = x;
  x = y;
  y = t - a / b * y;
  return d;
}
long long mod(long long a, long long b, long long p) {
  long long res = 1;
  long long i;
  for (i = a; i <= b; i++) res = (res * i) % p;
  return res;
}
long long mycom(long long n, long long m, long long p) {
  long long a, b, x, y;
  b = mod(1, m, p);
  a = mod(n - m + 1, n, p);
  extgcd(b, p, x, y);
  x = ((x * a) % p + p) % p;
  return x;
}
long long gao[1010];
int main() {
  long long i, n, m, ans = 1, need;
  gao[0] = 1;
  for (i = 1; i <= 1000; ++i) {
    gao[i] = (gao[i - 1] * 2) % 1000000007;
  }
  cin >> n >> m;
  for (i = 1; i <= m; ++i) cin >> A[i];
  sort(A + 1, A + 1 + m);
  k[0] = A[1] - 1;
  for (i = 1; i < m; ++i) k[i] = A[i + 1] - A[i] - 1;
  k[m] = n - A[m];
  need = n - m;
  for (i = 0; i <= m; ++i)
    if (k[i]) {
      ans = (ans * mycom(need, k[i], 1000000007)) % 1000000007;
      need -= k[i];
    }
  for (i = 1; i < m; ++i)
    if (k[i]) ans = (ans * gao[k[i] - 1]) % 1000000007;
  cout << ans << endl;
  return 0;
}
