#include <bits/stdc++.h>
using namespace std;
int main() {
  int fac(int n);
  int N, M, a[100010];
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> a[i];
  }
  int len[100010];
  len[0] = a[0] - 1;
  for (int i = 1; i < M; i++) {
    len[i] = a[i] - a[i - 1] - 2;
  }
  len[M] = N - a[M - 1] - 1;
  int total = 1, route = 0;
  for (int i = 0; i <= M; i++) {
    int rou_i = 0;
    for (int j = 0; j <= len[i] / 2; j++) {
      route = fac(len[i] - j) / (fac(j) * fac(len[i] - 2 * j));
      rou_i += route;
    }
    total *= rou_i;
  }
  cout << total % 1000000007 << endl;
}
int fac(int n) {
  int ans = 1;
  if (n == 0) {
    ans = 1;
  } else
    for (int i = 1; i <= n; i++) {
      ans *= i;
    }
  return ans;
}
