#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
const int MAXN = 1010;
const int MOD = 1000000007;
int mul(int a, int b) {
  long long M = 1ll * a * b;
  M %= (long long)MOD;
  return (int)M;
}
int mpow(int a, int p) {
  int res = 1;
  while (p > 0) {
    if (p & 1) res = mul(res, a);
    p /= 2;
    a = mul(a, a);
  }
  return res;
}
int first[MAXN];
int invf[MAXN];
int C(int n, int k) {
  int ret = mul(first[n], invf[k]);
  return mul(ret, invf[n - k]);
}
int calc(int n, int k) { return C(n + k - 1, k); }
int a[MAXN];
int n, m;
int main() {
  first[0] = 1;
  invf[0] = 1;
  for (int i = 1; i < MAXN; i++) {
    first[i] = mul(i, first[i - 1]);
    invf[i] = mpow(first[i], MOD - 2);
  }
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &a[i]), a[i]--;
  a[m++] = -1;
  a[m] = n;
  sort(a, a + m + 1);
  int cnt = 0;
  int ans = 1;
  for (int i = 0; i < m; i++) {
    int len = a[i + 1] - a[i] - 1;
    if (len == 0) continue;
    int cur = i == 0 || i == m - 1 ? 1 : mpow(2, len - 1);
    ans = mul(ans, mul(cur, calc(cnt + 1, len)));
    cnt += len;
  }
  printf("%d\n", ans);
  return 0;
}
