#include <bits/stdc++.h>
using namespace std;
long long mod = (long long)1e9 + 7;
int c[1005][1005];
long long binp(long long a, long long q) {
  a %= mod;
  if (q == 0) return 1;
  return ((q % 2 == 1 ? a : 1) * binp(a * a, q / 2)) % mod;
}
signed main() {
  std::ios_base::sync_with_stdio(0), cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= i; ++j) {
      if (j == 0 || i == j)
        c[i][j] = 1;
      else
        c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % mod;
    }
  }
  long long ans = 1;
  long long cur = 0;
  long long x = 0;
  for (int i = 0; i < m; ++i) {
    if (i == 0) {
      cur = a[i] - 1;
      x += cur;
      ans = ans * (c[x][cur]) % mod;
    } else {
      cur = a[i] - a[i - 1] - 1;
      x += cur;
      ans = ans * (c[x][cur]) % mod * binp(2, cur - 1) % mod;
    }
  }
  cur = n - a[m - 1];
  x += cur;
  ans = ans * (c[x][cur]) % mod;
  cout << ans;
  return 0;
}
