#include <bits/stdc++.h>
using namespace std;
int calcCmb(int a, int b) {
  if (b * 2 > a) b = a - b;
  int de = 1;
  int dor = 1;
  for (int i = int(1); i < int(b + 1); ++i) {
    de *= (a - i + 1);
    dor *= i;
  }
  return de / dor;
}
int main() {
  int N, M;
  cin >> N >> M;
  int a[M];
  for (int i = 0; i < (int)(M); i++) {
    cin >> a[i];
    if (i != 0 && a[i] - a[i - 1] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long int result = 1;
  for (int i = 0; i < (int)(M + 1); i++) {
    int current = (i == 0 ? 0 : a[i - 1] + 1);
    int to = (i == M ? N : a[i] - 1);
    if (current != to) {
      int cmb = 1;
      for (int i = 0; i < (int)((to - current) / 2); i++) {
        cmb += calcCmb(to - current - i - 1, i + 1);
      }
      result *= cmb;
      result %= 1000000007;
    }
  }
  cout << result << endl;
}
