#include <bits/stdc++.h>
using namespace std;
long long x, y, z[1005];
deque<long long> q, p;
long long fact(long long n) {
  long long s = 1;
  for (int i = n; i > 1; i--) {
    s *= i;
    s %= 1000000007;
  }
  return s % 1000000007;
}
long long pw(long long a, long long b, long long c) {
  long long res = 1;
  a = a % c;
  while (b > 0) {
    if (b & 1) res = (res * a) % c;
    b = b >> 1;
    a = (a * a) % c;
  }
  return res;
}
long long rec(long long s, long long ss) {
  long long a = 1;
  for (int i = max(s, ss) + 1; i <= s + ss; i++) {
    a = (a * i) % 1000000007;
  }
  long long c = fact(min(s, ss)) % 1000000007;
  return (a * pw((c), 1000000005, 1000000007)) % 1000000007;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cin >> x >> y;
  for (int i = 0; i < y; i++) {
    cin >> z[i];
  }
  sort(z, z + y);
  for (int i = 0; i < y; i++) {
    if (z[i] > 1 && z[i] < x) {
      q.push_back(abs(z[i] - i - 1));
      if (i == y - 1) {
        q.push_back(x - z[i]);
      } else {
        q.push_back(abs(z[i] - z[i + 1]) - 1);
      }
    }
  }
  for (int i = 1; i < y; i++) {
    p.push_back(abs(z[i] - z[i - 1] - 1));
  }
  long long ans = 1;
  for (int i = 0; i < p.size(); i++) {
    ans *= pw(2, p[i] - 1, 1000000007);
    ans %= 1000000007;
  }
  long long a = 1;
  for (int i = 1; i < q.size(); i += 2) {
    a *= rec(q[i - 1], q[i]);
    a %= 1000000007;
  }
  cout << (a * ans) % 1000000007 << endl;
  ;
  return 0;
}
