#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, a, b, c, e;
  e = 1;
  a = -1;
  cin >> N >> M;
  for (int i = 0; i < M; i++) {
    cin >> b;
    int f = 0;
    c = b - a - 2;
    if (c < 0) {
      e = 0;
      break;
    }
    a = b;
    for (int j = 0; j <= c / 2; j++) {
      int bunbo = 1, bunshi = 1, d = 1;
      for (int k = c - j; k > 0; k--) {
        bunshi *= k;
        bunbo *= d;
        d++;
      }
      f += (bunshi / bunbo);
    }
    e *= f;
    e %= 1000000007;
  }
  int f = 0;
  for (int j = 0; j <= (N - b - 1) / 2; j++) {
    if (N - b - 1 < 0) {
      e = 0;
      break;
    }
    int bunbo = 1, bunshi = 1, d = 1;
    for (int k = N - b - 1 - j; k > 0; k--) {
      bunshi *= k;
      bunbo *= d;
      d++;
    }
    f += (bunshi / bunbo);
  }
  e *= f;
  e %= 1000000007;
  cout << e << endl;
}
