#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
long long nn(int n) {
  if (n < 0) return -1;
  long long sum = 1;
  while (n > 1) {
    sum *= n;
    n--;
  }
  return sum;
}
int f(int a) {
  if (a <= 2) {
    return 1;
  } else if (a == 3)
    return 2;
  a = a - 2;
  long long set = a;
  long long sum = 0;
  while (a > 0) {
    sum += nn(a + 1) / nn(a);
    a--;
  }
  long long aa = pow(2, set);
  int ans = aa % 1000000007 - sum % 1000000007;
  return ans;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; ++i) cin >> a[i];
  sort(a.begin(), a.end());
  int bef = 0;
  long long sum = 1;
  for (int i = 0; i < m + 1; ++i) {
    sum = sum % 1000000007;
    if (i == m) {
      sum *= f(n - bef + 1);
    }
    if (i && a[i - 1] + 1 == a[i]) {
      cout << 0 << endl;
      return 0;
    }
    sum *= f(a[i] - bef);
    bef = a[i] + 1;
  }
  cout << sum % 1000000007 << endl;
  return 0;
}
