#include <bits/stdc++.h>
using namespace std;
long long factorial[1005], expo[1005];
long long fact(long long a) {
  if (factorial[a] != 0) return factorial[a];
  return factorial[a] = (a * fact(a - 1)) % 1000000007;
}
long long pow(long long a) {
  if (expo[a] != 0) return expo[a];
  return expo[a] = (2 * pow(a - 1)) % 1000000007;
}
long long invom(long long a, long long num) {
  if (num == 0)
    return 1;
  else if (num % 2 == 0) {
    long long temp = invom(a, num / 2);
    return (temp * temp) % 1000000007;
  }
  return (a * invom(a, num - 1)) % 1000000007;
}
int main() {
  factorial[0] = 1;
  expo[0] = 1;
  int n, m;
  scanf("%d%d", &n, &m);
  int arr[m];
  for (int i = 0; i < m; i++) scanf("%d", &arr[i]);
  sort(arr, arr + m);
  vector<int> bottom, power;
  int j = 1, top = n - m;
  for (int i = 0; i < m; i++) {
    bottom.push_back(arr[i] - j);
    if (i) {
      power.push_back(arr[i] - j);
    }
    j = arr[i] + 1;
  }
  bottom.push_back(n - arr[m - 1]);
  long long ans = 1, temp = 1;
  ans *= fact(top);
  ans %= 1000000007;
  for (int i = 0; i < bottom.size(); i++) {
    temp *= fact(bottom[i]);
    temp %= 1000000007;
  }
  temp = (invom(temp, 1000000007 - 2)) % 1000000007;
  ans *= temp;
  ans %= 1000000007;
  for (int i = 0; i < power.size(); i++) {
    if (power[i] > 0) {
      ans *= pow(power[i] - 1);
      ans %= 1000000007;
    }
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
