#include <bits/stdc++.h>
using namespace std;
int C(int N, int i) {
  int j = 1, k = 1;
  if (i == 0 || i == N) {
    return 1;
  } else {
    for (int a = N + 1 - i; a <= N; a++) {
      j *= a;
    }
    for (int a = 1; a <= i; a++) {
      k *= a;
    }
    return j / k;
  }
}
int main(void) {
  int N, M;
  cin >> N >> M;
  int broken[100000];
  int cal[100000];
  broken[0] = -1;
  broken[M + 1] = N + 1;
  for (int i = 1; i <= M; i++) {
    cin >> broken[i];
  }
  long count = 1;
  int end = 0;
  for (int i = 0; i <= M; i++) {
    cal[i] = broken[i + 1] - broken[i] - 2;
    if (cal[i] == -1) {
      end = 1;
    }
  }
  if (end == 1) {
    cout << 0 << endl;
  } else {
    int b;
    int sum;
    for (int i = 0; i <= M; i++) {
      b = 0;
      sum = 0;
      for (; cal[i] >= b; cal[i]--) {
        sum += C(cal[i], b);
        b++;
      }
      count *= sum;
    }
    cout << count % 1000000007 << endl;
  }
  return 0;
}
