#include <bits/stdc++.h>
using namespace std;
vector<int> twoadd(vector<int> v, int N) {
  v[N - 1] += 1;
  int ind = N - 1;
  int j = N - 1;
  for (j = N - 1; j >= 1; j--) {
    if (v[j] > 1) {
      v[j - 1] += 1;
      v[j] = 0;
    }
  }
  return v;
}
long long search(long long d) {
  long long count = 1;
  long long ld = d;
  for (int i = 0; i < ld / 2; i++) {
    d = d - 1;
    long long up = 1, down = 1, down2 = 1;
    for (int j = 0; j < d; j++) {
      up *= (long long)j + 1;
    }
    for (int j = 0; j < i + 1; j++) {
      down *= (long long)j + 1;
    }
    for (int j = 0; j < d - i - 1; j++) {
      down2 *= (long long)j + 1;
    }
    count += up / (down * down2);
  }
  return count;
}
int main() {
  int N, M;
  cin >> N >> M;
  long long ans = 1;
  vector<long long> a(M);
  for (int i = 0; i < M; i++) {
    cin >> a[i];
    if (a[i - 1] + 1 == a[i]) {
      cout << 0 << endl;
      exit(0);
    }
  }
  long long temp = 0;
  for (int i = 0; i < M; i++) {
    temp = a[i] - temp - 1;
    ans *= search(temp);
    temp = a[i] + 1;
    ans %= (long long)1000000007;
  }
  ans *= search(N - a[M - 1] - 1);
  ans %= (long long)1000000007;
  cout << ans << endl;
}
