#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int mod = 1000000007;
int mas[1010];
int pow2(int b) {
  if (b == -1) return 0;
  int res = 1;
  for (int i = 1; i <= b; i++) {
    res <<= 1;
    res %= mod;
  }
  return res;
}
int GCD(int a, int b) {
  if (b == 0)
    return a;
  else
    return GCD(b, a % b);
}
vector<int> v;
vector<int> C;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) scanf("%d", &mas[i]);
  sort(mas, mas + m);
  if (mas[0] != 1) v.push_back(mas[0] - 1);
  if ((n > 1 || m != 1) && mas[m - 1] != n) v.push_back(n - mas[m - 1]);
  for (int i = 1; i < m; i++) {
    int a = pow2(mas[i] - mas[i - 1] - 2);
    if (mas[i] - 1 != mas[i - 1]) v.push_back(mas[i] - mas[i - 1] - 1);
    a = max(a, 1);
    C.push_back(a);
  }
  sort(v.begin(), v.end());
  int S = 0;
  vector<int> F;
  for (int i = 0, maxi = (int)(v).size(); i < maxi; i++) S += v[i];
  for (int i = 2; i <= S; i++) F.push_back(i);
  vector<int> VVV;
  for (int i = 0, maxi = (int)(v).size(); i < maxi; i++)
    for (int j = 2; j <= v[i]; j++) VVV.push_back(j);
  for (int i = 0, maxi = (int)(VVV).size(); i < maxi; i++) {
    for (int j = 0, maxj = (int)(F).size(); j < maxj; j++) {
      if (VVV[i] == 1) break;
      int G = GCD(F[j], VVV[i]);
      VVV[i] /= G;
      F[j] /= G;
    }
  }
  long long ans = 1;
  for (int i = 0, maxi = (int)(F).size(); i < maxi; i++)
    ans *= (long long)F[i], ans %= (long long)mod;
  for (int i = 0, maxi = (int)(C).size(); i < maxi; i++)
    ans *= (long long)C[i], ans %= (long long)mod;
  cout << ans << endl;
  return 0;
}
