#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
const int MAXN = 1005;
int Arr[MAXN];
int N, M;
long long c_[MAXN][MAXN];
long long pow_t[MAXN];
void init() {
  pow_t[0] = 1;
  c_[0][0] = 1;
  for (int i = 1; i < MAXN; i++) {
    c_[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      c_[i][j] = (c_[i - 1][j] + c_[i - 1][j - 1]) % mod;
    }
    c_[i][i] = 1;
    pow_t[i] = (pow_t[i - 1] * 2) % mod;
  }
}
int main() {
  init();
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; i++) {
    scanf("%d", &Arr[i]);
  }
  sort(Arr, Arr + M);
  int num = N - M;
  long long res = c_[num][Arr[0] - 1];
  num -= Arr[0] - 1;
  for (int i = 1; i < M; i++) {
    int x = Arr[i] - Arr[i - 1] - 1;
    if (x > 0)
      res = ((res * c_[num][x] % mod) * pow_t[x - 1]) % mod;
    else
      res = res * c_[num][x] % mod;
    num -= x;
  }
  res = (res * c_[num][N - Arr[M - 1]]) % mod;
  printf("%lld\n", res);
  return 0;
}
