#include <bits/stdc++.h>
using namespace std;
int n, m, total;
long long ans;
long long c[1010][1010];
int a[1010];
long long pow(int a, int b) {
  if (b == 0) return 1;
  if (b % 2 == 1) return (a * pow(a, b - 1)) % 1000000007;
  long long ans = pow(a, b / 2);
  return (ans * ans) % 1000000007;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> a[i];
  sort(a, a + m);
  c[0][0] = 1;
  for (int i = 1; i <= 1000; i++) {
    c[i][0] = 1;
    for (int j = 1; j <= 1000; j++)
      c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % 1000000007;
  }
  total = n - m;
  for (int i = 0; i < m; i++)
    if (i == 0) {
      ans = c[total][a[i] - 1];
      total -= a[i] - 1;
    } else {
      int len = a[i] - a[i - 1] - 1;
      if (len == 0) continue;
      ans = (ans * pow(2, len - 1)) % 1000000007;
      ans = (ans * c[total][len]) % 1000000007;
      total -= len;
    }
  cout << ans << endl;
}
