#include <bits/stdc++.h>
using namespace std;
int M = 1000000007;
long long a[1010][1010];
int lights[1010];
int blocks[1010];
long long pow(int n) {
  long long p = 1;
  for (int i = 1; i <= n; i++) {
    p *= 2;
    if (p > M) p -= M;
  }
  return p;
}
int main() {
  int n, m, i, j, num = 1;
  long long sum = 0, multinom = 1, p;
  cin >> n >> m;
  for (i = 0; i <= n; i++) a[i][0] = 1, lights[i] = blocks[i] = 0;
  for (i = 0; i <= n; i++)
    for (j = 1; j <= n; j++)
      if (i < j)
        a[i][j] = 0;
      else {
        a[i][j] = a[i - 1][j] + a[i - 1][j - 1];
        if (a[i][j] > M) a[i][j] -= M;
      }
  for (i = 1; i <= m; i++) {
    cin >> j;
    lights[j] = 1;
  }
  for (i = 1; i <= n; i++)
    if (!lights[i])
      blocks[num]++;
    else if (!lights[i - 1])
      num++;
  for (i = 2; i < num; i++) sum += blocks[i];
  p = pow(sum - num + 2);
  sum = 0;
  for (i = 1; i <= num; i++) {
    sum += blocks[i];
    multinom *= a[sum][blocks[i]];
    if (multinom > M) multinom %= M;
  }
  cout << ((multinom * p) % M);
  return 0;
}
