#include <bits/stdc++.h>
using namespace std;
const int MAX = 1001;
long long modular_expo(long long a, long long base) {
  long long ans = 1;
  while (base > 0) {
    if (base % 2 == 1) ans = (ans * a) % 1000000007;
    a = (a * a) % 1000000007;
    base /= 2;
  }
  return ans;
}
long long fact[MAX], infact[MAX];
int main() {
  fact[0] = infact[0] = 1;
  for (int i = 1; i < MAX; i++) {
    fact[i] = (i * fact[i - 1]) % 1000000007;
    infact[i] = modular_expo(fact[i], 1000000007 - 2);
  }
  long long n, m;
  scanf("%lld %lld", &n, &m);
  long long arr[m];
  for (int i = 0; i < m; i++) scanf("%lld", &arr[i]);
  sort(arr, arr + m);
  long long ans = fact[n - m];
  for (int i = 1; i < m; i++) {
    if (arr[i] - arr[i - 1] > 1)
      ans = (ans * modular_expo(2, arr[i] - arr[i - 1] - 2)) % 1000000007;
  }
  for (int i = 1; i < m; i++) {
    if (arr[i] - arr[i - 1] > 1)
      ans = (ans * infact[arr[i] - arr[i - 1] - 1]) % 1000000007;
  }
  ans = (ans * infact[arr[0] - 1]) % 1000000007;
  ans = (ans * infact[n - arr[m - 1]]) % 1000000007;
  printf("%lld\n", ans);
  return 0;
}
