#include <bits/stdc++.h>
using namespace std;
struct range {
  int size;
  bool both;
  range() {}
  range(int a, int b) {
    size = a;
    both = b;
  }
};
long long mod(long long a, long long b) { return ((a % b) + b) % b; }
long long fact(int num) {
  long long f = 1;
  for (int i = 2; i <= num; ++i) {
    f *= (long long)i;
    f = mod(f, 1000000007LL);
  }
  return f;
}
long long pow(int base, int num) {
  long long f = 1;
  for (int i = 0; i < num; ++i) {
    f *= base;
    f = mod(f, 1000000007LL);
  }
  return f;
}
long long extended_euclid(long long a, long long b, long long &x,
                          long long &y) {
  long long xx = y = 0;
  long long yy = x = 1;
  while (b) {
    long long q = a / b;
    long long t = b;
    b = a % b;
    a = t;
    t = xx;
    xx = x - q * xx;
    x = t;
    t = yy;
    yy = y - q * yy;
    y = t;
  }
  return a;
}
long long mod_inverse(long long a, long long n) {
  long long x, y;
  long long d = extended_euclid(a, n, x, y);
  if (d > 1) return -1;
  return mod(x, n);
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> ons;
  for (int i = 0; i < M; ++i) {
    int a;
    scanf("%d", &a);
    ons.push_back(a);
  }
  sort(ons.begin(), ons.end());
  vector<range> ranges;
  ranges.push_back(range(ons[0] - 1, false));
  for (int i = 0; i < M - 1; ++i) {
    ranges.push_back(range(ons[i + 1] - ons[i] - 1, true));
  }
  ranges.push_back(range(N - ons[M - 1], false));
  long long top = 1;
  long long bottom = 1;
  int sum = 0;
  for (int i = 0; i < ranges.size(); ++i) {
    if (ranges[i].size > 0) {
      sum += ranges[i].size;
      top *= ranges[i].both ? pow(2, ranges[i].size - 1) : 1;
      top = mod(top, 1000000007LL);
      bottom *= fact(ranges[i].size);
      bottom = mod(bottom, 1000000007LL);
    }
  }
  top *= fact(sum);
  top = mod(top, 1000000007LL);
  cout << mod(top * mod_inverse(bottom, 1000000007LL), 1000000007LL) << endl;
  return 0;
}
