#include <bits/stdc++.h>
using namespace std;
long long int mod = 1e9 + 7;
using namespace std::chrono;
long long int power(long long int a, long long int b) {
  a %= mod;
  long long int ans = 1;
  while (b != 0) {
    if (b & 1) ans = (ans * a) % mod;
    a = (a * a) % mod;
    b = b >> 1;
  }
  return ans;
}
int main() {
  long long int n, m, val, num, den = 0, x = 0, y, r = 0;
  cin >> n >> m;
  vector<long long int> vec;
  for (int i = 0; i < m; i++) {
    long long int xx;
    cin >> xx;
    vec.push_back(xx);
  }
  sort(vec.begin(), vec.end());
  long long int dp[n + 1];
  memset(dp, 0, sizeof(dp));
  dp[0] = dp[1] = 1;
  for (int i = 0; i < m - 1; i++) {
    y = max(vec[i + 1] - vec[i] - 2, 0LL);
    x += y;
    r += vec[i + 1] - vec[i] - 1;
  }
  for (int i = 2; i <= n; i++) dp[i] = (dp[i - 1] * i) % mod;
  den = (dp[vec[0] - 1] * dp[n - vec[m - 1]]) % mod;
  for (int i = 0; i < m - 1; i++) {
    y = vec[i + 1] - vec[i] - 1;
    den = (den * dp[y]) % mod;
  }
  val = power(2, x);
  num = 1;
  r += vec[0] - 1 + n - vec[m - 1];
  num = dp[r];
  den = power(den, mod - 2);
  long long int ans = (((den * num) % mod) * val) % mod;
  cout << ans;
  return 0;
}
