#include <bits/stdc++.h>
using namespace std;
#pragma GCC push_options
#pragma GCC optimize("unroll-loops")
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  long long ar[m];
  for (int i = 0; i < m; i++) cin >> ar[i];
  sort(ar, ar + m);
  long long nCr[n + 1][n + 1];
  long long pow1[n + 1];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= i; j++) {
      if (j == 0 || j == i)
        nCr[i][j] = 1ll;
      else {
        nCr[i][j] = (nCr[i - 1][j] + nCr[i - 1][j - 1]) % 1000000007;
      }
    }
  }
  pow1[0] = pow1[1] = 1ll;
  for (int i = 2; i <= n; i++) pow1[i] = (pow1[i - 1] * 2) % 1000000007;
  long long count = 0ll;
  long long ans = 1ll;
  for (int i = 0; i < m; i++) {
    long long ashu;
    if (i == 0)
      ashu = ar[i] - 1;
    else {
      ashu = ar[i] - ar[i - 1] - 1;
      ans = (ans * pow1[ashu]) % 1000000007;
    }
    count += ashu;
    ans = (ans * nCr[count][ashu]) % 1000000007;
  }
  count += n - ar[m - 1];
  ans = (ans * nCr[count][n - ar[m - 1]]) % 1000000007;
  cout << ans << "\n";
  return 0;
}
