#include <bits/stdc++.h>
using namespace std;
long long bp(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) {
      res *= x;
      res %= 1000000007;
    }
    x *= x;
    x %= 1000000007;
    y >>= 1;
  }
  return res;
}
long long fak[1003];
int a[1003];
int tem[1003];
void mergesort(int *a, int *b, int n) {
  int i, i0, i1, iRight, iEnd, width, j;
  for (width = 1; width < n; width *= 2)
    for (i = 0; i + width < n; i += width * 2) {
      i0 = i;
      i1 = iRight = i + width;
      iEnd = min(i + width * 2, n);
      for (j = i; i0 < iRight; j++)
        if (i1 == iEnd || a[i0] < a[i1])
          b[j] = a[i0++];
        else
          b[j] = a[i1++];
      for (j = i; j < i1; j++) a[j] = b[j];
    }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  int i;
  fak[0] = 1;
  for (i = 1; i <= n; i++) fak[i] = (fak[i - 1] * i) % 1000000007;
  for (i = 0; i < m; i++) scanf("%d", &a[i]);
  mergesort(a, tem, m);
  long long ans = 1;
  for (i = 1; i < m; i++)
    ans = (ans * bp(2, max(0, (a[i] - a[i - 1] - 2)))) % 1000000007;
  ans = (ans * fak[n - m]) % 1000000007;
  long long znam = 1;
  for (i = 1; i < m; i++) znam = (znam * fak[a[i] - a[i - 1] - 1]) % 1000000007;
  znam = (znam * fak[a[0] - 1]) % 1000000007;
  znam = (znam * fak[n - a[m - 1]]) % 1000000007;
  ans = (ans * bp(znam, 1000000007 - 2)) % 1000000007;
  printf("%d\n", (int)ans);
  return 0;
}
