#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a > b) {
    swap(a, b);
  }
  while (b % a != 0) {
    b %= a;
    swap(a, b);
  }
  return a;
}
int kaijou(int n) {
  int a = 1;
  if (n == 0) {
    return 1;
  }
  for (int i = 0; i < n; i++) {
    a *= i + 1;
  }
  return a;
}
int ncr(int n, int r) {
  int a;
  if (n < 0 || r < 0 || n < r) {
    return 0;
  }
  a = kaijou(n) / kaijou(r) / kaijou(n - r);
  return a;
}
int main() {
  int N, M;
  long long ans = 1, buff = 0;
  cin >> N >> M;
  vector<int> v(M + 2);
  v[0] = 0;
  v[M + 1] = N;
  for (int i = 0; i < M; i++) {
    cin >> v[i + 1];
  }
  for (int i = 0; i < M + 1; i++) {
    if (v[i] + 1 == v[i + 1]) {
      continue;
    } else if ((v[i + 1] - v[i] - 1) % 2 == 0) {
      buff = 0;
      for (int j = 0; j < (v[i + 1] - v[i] - 1) / 2 + 1; j++) {
        buff += ncr((v[i + 1] - v[i] - 1) / 2 + j, 2 * j);
      }
      ans *= buff;
    } else {
      buff = 0;
      for (int j = 0; j < (v[i + 1] - v[i] - 2) / 2 + 1; j++) {
        buff += ncr((v[i + 1] - v[i]) / 2 + j, 2 * j + 1);
      }
      ans *= buff;
    }
  }
  cout << ans % 1000000007 << endl;
}
