#include <bits/stdc++.h>
using namespace std;
int partAns(int L);
int N, M;
int a[100000];
int main() {
  int i;
  int j = 1;
  int ans;
  int l[100000];
  cin >> N >> M;
  for (i = 0; i < M; i++) {
    cin >> a[i];
    if (i > 0) {
      if (a[i] - a[i - 1] == 1) {
        cout << 0;
        return -1;
      } else {
        l[j] = a[i] - a[i - 1] - 1;
        j++;
      }
    } else {
      l[0] = a[0] - 1;
    }
  }
  l[j] = N - a[M - 1] - 1;
  if (j == 0) {
    cout << partAns(N);
  } else {
    ans = 1;
    for (i = 1; i < j; i++) {
      ans *= partAns(l[j]);
    }
    if (l[0] != 0) {
      ans *= partAns(l[0]);
    }
    if (l[j] != 0 && j > 1) {
      ans *= partAns(l[j]);
    }
    cout << ans % 1000000007;
  }
  return 0;
}
int partAns(int L) {
  int S = 0;
  int P = 1;
  int i, j;
  int maxN = floor(L / 2);
  j = 0;
  while (L - j >= j) {
    P = 1;
    for (i = 1; i <= L - j; i++) {
      P *= i;
    }
    for (i = 1; i <= L - 2 * j; i++) {
      P /= i;
    }
    for (i = 1; i <= j; i++) {
      P /= i;
    }
    S += P;
    j++;
  }
  return S;
}
