#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-31;
const double PI = acos(-1);
const long long INFF = (long long)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const int MAX = (int)1e3 + 7;
long long v[MAX], val[MAX], re_val[MAX];
long long mypow(long long vv, long long t) {
  long long res = 1;
  while (t) {
    if (t & 1) res = res * vv % mod;
    vv = vv * vv % mod;
    t >>= 1;
  }
  return res;
}
void build() {
  v[0] = v[1] = 1;
  for (int i = (2); i < (MAX); ++i) v[i] = 2 * v[i - 1] % mod;
  long long cur = val[0] = 1;
  for (int i = (1); i < (MAX); ++i) {
    cur = cur * i % mod;
    val[i] = cur;
  }
  for (int i = 0; i < (MAX); ++i) re_val[i] = mypow(val[i], mod - 2);
  return;
}
vector<int> st;
int main(void) {
  build();
  int n, m;
  scanf("%d %d", &n, &m);
  ;
  for (int i = 0; i < (m); ++i) {
    int vv;
    scanf("%d", &vv);
    ;
    st.push_back(vv);
  }
  sort((st).begin(), (st).end());
  long long ans = 1;
  int cnt = 0;
  for (int i = 0; i < (m); ++i) {
    if (i == 0) {
      ans = ans * re_val[st[0] - 1] % mod;
      cnt += st[0] - 1;
    }
    if (i == m - 1) {
      ans = ans * re_val[n - st[i]] % mod;
      cnt += n - st[i];
    }
    if (i - 1 >= 0) {
      ans = ans * v[st[i] - st[i - 1] - 1] % mod;
      ans = ans * re_val[st[i] - st[i - 1] - 1] % mod;
      cnt += st[i] - st[i - 1] - 1;
    }
  }
  ans = ans * val[cnt] % mod;
  printf("%lld\n", ans);
  return 0;
}
