#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
int n, m, f[1001] = {1};
string s;
vector<int> v;
int Pow(int b, int p) {
  if (!p) return 1;
  long long z = Pow(b, p / 2);
  if (p & 1) return z * z % M * b % M;
  return z * z % M;
}
int main() {
  for (int i = 1; i <= 1000; ++i) f[i] = f[i - 1] * (long long)i % M;
  cin >> n >> m;
  s.resize(n, '0');
  for (int i = 0, x; i < m; ++i) {
    cin >> x;
    s[x - 1] = '1';
  }
  int c = 0;
  for (int i = 0; i < n; ++i)
    if (s[i] == '0')
      ++c;
    else if (c) {
      v.push_back(c);
      c = 0;
    }
  if (c) v.push_back(c);
  bool a, b;
  a = b = false;
  if (s[0] == '0') a = true;
  if (s[n - 1] == '0' && v.size()) b = true;
  long long res = f[n - m];
  for (int i = 0; i < v.size(); ++i) res = res * Pow(f[v[i]], M - 2) % M;
  for (int i = a; i + b < v.size(); ++i) res = res * Pow(2, v[i] - 1) % M;
  cout << res << endl;
  return 0;
}
