#include <bits/stdc++.h>
using namespace std;
long long as(long long a, long long b, long long c) {
  long long res = 1;
  long long temp = a;
  while (b > 0) {
    if (b & 1) {
      res = (res * temp) % c;
    }
    temp = (temp * temp) % c;
    b >>= 1;
  }
  return res;
}
long long f[1008][1008];
void hello() {
  f[0][0] = 1;
  for (int i = 1; i < 1008; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || i == j) {
        f[i][j] = 1;
      } else {
        f[i][j] = (f[i - 1][j] + f[i - 1][j - 1]) % 1000000007;
      }
    }
  }
}
int main() {
  hello();
  long long n, m;
  while (cin >> n >> m) {
    long long a[m], b[m + 1], t;
    long long s = 1;
    for (int i = 0; i < m; i++) {
      cin >> a[i];
    }
    sort(a, a + m);
    for (int i = 0; i <= m; i++) {
      if (i == 0) {
        b[i] = a[i] - 1;
      } else if (i == m) {
        b[i] = n - a[i - 1];
      } else {
        b[i] = a[i] - a[i - 1] - 1;
      }
    }
    t = n - m;
    for (int i = 0; i <= m; i++) {
      s *= f[t][b[i]];
      s %= 1000000007;
      t -= b[i];
    }
    for (int i = 1; i < m; i++) {
      s *= as(2, b[i] - 1, 1000000007);
      s = s % 1000000007;
    }
    s %= 1000000007;
    cout << s << endl;
  }
  return 0;
}
