#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, k, l, m, n, o, p, ans = 1, ct, term, z = 1000000007, prev;
  long long int ncr[1001][1001];
  for (i = 0; i < 1001; i++) {
    for (j = 0; j <= i; j++) {
      if (i == 0 || j == 0) {
        ncr[i][j] = 1;
      } else {
        ncr[i][j] = (ncr[i - 1][j] + ncr[i - 1][j - 1]) % z;
      }
    }
  }
  cin >> n >> m;
  long long int pow[n];
  pow[0] = 1;
  pow[1] = 1;
  for (i = 2; i <= n; i++) {
    pow[i] = (pow[i - 1] * 2) % z;
  }
  long long int A[m];
  prev = 0;
  ct = 0;
  for (i = 0; i < m; i++) {
    cin >> A[i];
  }
  sort(A, A + m);
  for (i = 0; i < m; i++) {
    if (i == 0) {
      term = (A[i] - prev - 1);
      ct += term;
      ans = (ans * ncr[ct][term]) % z;
      prev = A[i];
    } else {
      term = A[i] - prev - 1;
      ct += term;
      ans = (ans * ncr[ct][term]) % z;
      ans = (ans * pow[term]) % z;
      prev = A[i];
    }
  }
  term = n - A[m - 1];
  ct += term;
  ans = (ans % z * ncr[ct][term]) % z;
  cout << ans << endl;
}
