#include <bits/stdc++.h>
#pragma warning(disable : 4996)
int jun(int n) {
  int ret = 1;
  for (int i = n; i > 0; --i) {
    ret = (ret * i) % 1000000007;
  }
  return ret;
}
int calc(int n) {
  int cc = 0;
  int two_max = n / 2;
  for (int i = 0; i <= two_max; ++i) {
    int one = n - 2 * i;
    int junOne = jun(one);
    int junTwo = jun(i);
    int junAll = jun(one + i);
    int c = (junAll / (junOne * junTwo)) % 1000000007;
    cc = (cc + c) % 1000000007;
  }
  return cc;
}
int main(void) {
  int n, m;
  scanf("%d %d", &n, &m);
  std::vector<int> A;
  for (int i = 0; i < m; ++i) {
    int a;
    scanf("%d", &a);
    A.push_back(a);
  }
  A.push_back(n + 1);
  int now = 0;
  int c = 1;
  for (int i = 0; i < n; ++i) {
    int l = A[i] - now - 1;
    if (l == 0) {
      printf("0");
      return 0;
    }
    c = (c * calc(l - 1)) % 1000000007;
    now = A[i] - 1;
  }
  printf("%d", c);
  return 0;
}
