#include <bits/stdc++.h>
int combination(int n, int r);
int main(void) {
  int i, j, k;
  unsigned int N, M, pre;
  int array[100000];
  unsigned long answer = 0, temp;
  int oneOrZero;
  scanf("%d %d", &N, &M);
  for (i = 0; i < M; i++) {
    scanf("%d", &array[i]);
  }
  pre = array[0];
  for (i = 1; i < M; i++) {
    if ((pre + 1) == array[i]) {
      printf("0\n");
      return 0;
    }
  }
  if (array[0] % 2 == 0)
    oneOrZero = 0;
  else
    oneOrZero = 1;
  for (i = array[0] - 1; i >= oneOrZero; i -= 2) {
    answer += combination(array[0] - 1, i);
  }
  for (i = 1; i < M - 1; i++) {
    temp = 0;
    if ((array[i + 1] - array[i] - 1) % 2 == 0)
      oneOrZero = 0;
    else
      oneOrZero = 1;
    for (i = array[i + 1] - array[i] - 1; i >= oneOrZero; i -= 2) {
      temp += combination(array[i + 1] - array[i] - 1, i);
    }
    answer = answer % 1000000007;
    temp = temp % 1000000007;
    answer *= temp;
  }
  temp = 0;
  if ((N - array[M - 1]) % 2 == 0)
    oneOrZero = 0;
  else
    oneOrZero = 1;
  for (i = N - array[M - 1]; i >= oneOrZero; i -= 2) {
    temp += combination(N - array[M - 1], i);
  }
  answer = answer % 1000000007;
  temp = temp % 1000000007;
  answer *= temp;
  printf("%lu\n", answer);
  return 0;
}
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));
}
