#include <bits/stdc++.h>
using namespace std;
int c(int x, int N) {
  int c = 1;
  if (x != 0 && x != N) {
    for (int i = 1; i <= N; i++) {
      c *= i;
    }
    for (int j = 1; j <= x; j++) {
      c /= j;
    }
    for (int k = 1; k <= N - x; k++) {
      c /= k;
    }
  } else
    c = 1;
  return c;
}
int main() {
  int N, M, sum = 1;
  cin >> N >> M;
  int s[M];
  for (int i = 0; i < M; i++) {
    cin >> s[i];
  }
  int judge = 0;
  for (int i = 0; i < M - 1; i++) {
    if (s[i] == s[i + 1]) judge = 1;
    cout << 0 << endl;
  }
  int a[M + 1];
  if (judge == 0) {
    if (M > 0) {
      for (int i = 0; i < M - 1; i++) {
        a[i] = s[i + 1] - s[i] - 2;
      }
      a[M - 1] = s[0] - 1;
      a[M] = N - s[M - 1] - 1;
    } else
      a[0] = N;
  }
  int lsum = 0;
  for (int i = 0; i < M + 1; i++) {
    lsum = 0;
    if (a[i] % 2 == 0) {
      for (int j = 0; j <= a[i] / 2; j++) {
        lsum += c(j, a[i] - j);
      }
    } else {
      for (int j = 0; j <= (a[i] - 1) / 2; j++) {
        lsum += c(j, a[i] - j);
      }
    }
    sum *= lsum;
  }
  cout << sum % 1000000007 << endl;
}
