#include <bits/stdc++.h>
using namespace std;
const int N = 1005;
const long long M = 1000000007;
long long c[N][N];
int a[N];
void prework() {
  for (int i = 0; i <= N; i++) {
    c[i][0] = 1;
    c[i][i] = 1;
  }
  for (int i = 2; i < N; i++)
    for (int j = 1; j < i; j++) c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % M;
}
long long power(long long x, long long n) {
  if (!n) return 1 % M;
  long long temp = power(x, n >> 1);
  temp = temp * temp % M;
  if (n & 1) temp = temp * x % M;
  return temp;
}
int main() {
  int n, m, x, num;
  long long ans;
  prework();
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
    sort(a + 1, a + m + 1);
    num = n - m;
    x = a[1] - 1;
    ans = c[num][x];
    for (int i = 2; i <= m; i++) {
      num -= x;
      x = a[i] - a[i - 1] - 1;
      if (x) ans = ((ans * c[num][x]) % M * power(2, x - 1)) % M;
    }
    printf("%I64d\n", ans);
  }
  return 0;
}
