#include <bits/stdc++.h>
using namespace std;
const int N = 1234;
const long long MODN = 1000ll * 1000ll * 1000ll + 7ll;
int a[N];
long long pw(long long a, long long b) {
  if (b <= 0) return 1ll;
  if (b & 1) return (a * pw(a, b - 1)) % MODN;
  long long tmp = pw(a, b / 2);
  return (tmp * tmp) % MODN;
}
long long fact(long long x) {
  if (x == 0) return 1ll;
  return (x * fact(x - 1)) % MODN;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    a[--x] = 1;
  }
  int idx = 0;
  long long res = 1ll;
  int lastOne = -1;
  vector<int> zeros;
  int cnt = 0;
  int nbZeros = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == 1) {
      if (lastOne != -1) {
        res *= pw(2ll, nbZeros - 1);
        res %= MODN;
        zeros.push_back(nbZeros);
      } else
        zeros.push_back(nbZeros);
      lastOne = i;
      nbZeros = 0;
    } else {
      nbZeros++;
      cnt++;
    }
  }
  if (nbZeros != 0) zeros.push_back(nbZeros);
  res *= fact(cnt);
  res %= MODN;
  long long denom = 1ll;
  for (int i = 0; i < (int)zeros.size(); i++) {
    denom *= fact(zeros[i]);
    denom %= MODN;
  }
  long long inv = pw(denom, MODN - 2) % MODN;
  cout << (res * inv) % MODN << "\n";
  return 0;
}
