#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, i, j, x, a[100000];
  long long int ans = 1;
  scanf("%d", &n);
  scanf("%d", &m);
  a[0] = -1;
  for (i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    x = a[m] - a[m - 1] - 1;
    for (j = 0; x < j * 2; j++) ans *= combination(x - j, j);
  }
  x = n - a[m] - 1;
  for (j = 0; x < j * 2; j++) ans *= combination(x - j, j);
  printf("%d", ans % 1000000007);
}
