#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int f[1005], a[1005], n, m, c[1005][1005];
int b[1005], len;
void init() {
  f[0] = 1;
  for (int i = 1; i < 1005; i++) {
    f[i] = f[i - 1] * 2;
    f[i] %= mod;
  }
  c[0][0] = 1;
  for (int i = 1; i <= 1000; i++) {
    c[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      if (j > i / 2)
        c[i][j] = c[i][i - j];
      else {
        c[i][j] = c[i - 1][j - 1] + c[i - 1][j];
        c[i][j] %= mod;
      }
    }
  }
}
int main() {
  init();
  scanf("%d%d", &n, &m);
  memset(a, 0, sizeof(a));
  int x;
  for (int i = 0; i < m; i++) {
    scanf("%d", &x);
    a[x] = 1;
  }
  len = 0;
  int flag = 0, num = 0;
  for (int i = 1; i <= n; i++) {
    if (a[i]) {
      if (flag) b[len++] = num;
      flag = num = 0;
    } else {
      flag = 1;
      num++;
    }
  }
  if (flag) b[len++] = num;
  long long ans = 1;
  int start, endd;
  if (a[1])
    start = 0;
  else
    start = 1;
  if (a[n])
    endd = len;
  else
    endd = len - 1;
  for (int i = start; i < endd; i++) {
    ans = ans * f[b[i] - 1];
    ans %= mod;
  }
  int tmp = n - m;
  for (int i = 0; i < len - 1; i++) {
    ans *= c[tmp][b[i]];
    ans %= mod;
    tmp -= b[i];
  }
  cout << ans << endl;
  return 0;
}
