#include <bits/stdc++.h>
using namespace std;
int MOD = 1000000007;
int part_way = 0;
vector<int> part_ways;
void ways(int start, int end) {
  int dis = end - start;
  if (dis < 0) {
    return;
  }
  if (dis == 0) {
    ++part_way;
    return;
  }
  if (dis == 1)
    ways(start, end - 1);
  else {
    ways(start, end - 1);
    ways(start, end - 2);
  }
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M);
  for (int i = 0; i < M; ++i) cin >> a[i];
  for (int i = 0; i < M; ++i) {
    part_way = 0;
    if (i == 0)
      ways(0, a[i] - 1);
    else
      ways(a[i - 1] + 1, a[i] - 1);
    part_ways.push_back(part_way);
  }
  part_way = 0;
  ways(*(a.end() - 1) + 1, N);
  part_ways.push_back(part_way);
  long long int ans = 1;
  for (int v : part_ways) {
    ans *= v;
  }
  cout << ans % MOD << endl;
}
