#include <bits/stdc++.h>
int combination(int n, int r) {
  if (r == 0 || r == n)
    return (1);
  else if (r == 1)
    return (n);
  return (combination(n - 1, r - 1) + combination(n - 1, r));
}
int main() {
  int N, M;
  scanf("%d %d", &N, &M);
  int a[M + 1], i, j, S[N];
  long long int ans = 1;
  for (i = 0; i < M; i++) {
    scanf("%d", &a[i]);
  }
  int cnt = 1;
  S[0] = a[0] - 2;
  for (i = 0; i < M - 1; i++) {
    S[cnt] = 1;
    cnt++;
    S[cnt] = a[i + 1] - a[i] - 2;
    if (S[cnt] < 0) {
      printf("0");
      return 0;
    }
    cnt++;
  }
  S[cnt] = 1;
  cnt++;
  S[cnt] = N - a[i] - 1;
  cnt++;
  long long int *K = (long long int *)calloc(N, sizeof(long long int));
  for (i = 0; i < cnt; i++) {
    if (S[i] != 0) {
      for (j = 0; j < (S[i] / 2) + 1; j++) {
        K[i] += combination(S[i] - j, j);
      }
    } else {
      K[i] = 1;
    }
  }
  for (i = 0; i < cnt; i++) {
    ans *= K[i];
  }
  printf("%d", (int)(ans % (long long int)1000000007));
  return 0;
}
