#include <bits/stdc++.h>
const long double PI = 3.141592653589793238L;
using namespace std;
long long fact[1001], ifact[1001];
vector<int> v;
long long power(long long x, int n) {
  if (!n) return 1;
  x %= (1000 * 1000 * 1000 + 7);
  long long y = power(x, n / 2);
  y = (y * y) % (1000 * 1000 * 1000 + 7);
  if (n % 2) y *= x;
  return y % (1000 * 1000 * 1000 + 7);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  *fact = fact[1] = 1, *ifact = ifact[1] = 1;
  for (int i = 2; i <= 1000; ++i)
    fact[i] = (i * fact[i - 1]) % (1000 * 1000 * 1000 + 7),
    ifact[i] = power(fact[i], (1000 * 1000 * 1000 + 7) - 2);
  int N, M;
  cin >> N >> M;
  for (int i = 1; i <= M; ++i) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  sort(v.begin(), v.end());
  v.push_back(N - v[v.size() - 1]);
  for (int i = v.size() - 2; i > 0; --i) v[i] -= v[i - 1] + 1;
  v[0] -= 1;
  long long final_ans = fact[N - M];
  final_ans *=
      (ifact[v[0]] * ifact[v[v.size() - 1]]) % (1000 * 1000 * 1000 + 7),
      final_ans %= (1000 * 1000 * 1000 + 7);
  int n = 0;
  for (int i = 1; i < v.size() - 1; ++i) {
    if (!v[i]) continue;
    ++n;
    long long ans = 0;
    for (int j = 0; j <= v[i]; ++j)
      ans = (ans + (ifact[j] * ifact[v[i] - j]) % (1000 * 1000 * 1000 + 7)) %
            (1000 * 1000 * 1000 + 7);
    final_ans *= ans, final_ans %= (1000 * 1000 * 1000 + 7);
  }
  final_ans *= power(power(2, n), (1000 * 1000 * 1000 + 7) - 2),
      final_ans %= (1000 * 1000 * 1000 + 7);
  cout << final_ans;
  return 0;
}
