#include <bits/stdc++.h>
int main() {
  using ull = unsigned long long;
  ull N, M;
  std::cin >> N >> M;
  std::vector<ull> D;
  long long p = -1;
  long long max_diff = 0;
  for (ull m = 0; m < M; m++) {
    long long a;
    std::cin >> a;
    long long d = a - 1 - (p + 1);
    if (d < 0) {
      std::cout << 0 << std::endl;
      return 0;
    }
    D.push_back(d);
    if (max_diff < d) max_diff = d;
    p = a;
  }
  long long d = N - (p + 1);
  if (max_diff < d) max_diff = d;
  D.push_back(d);
  std::vector<ull> count(max_diff + 1);
  count[0] = 1;
  count[1] = 1;
  for (ull i = 0; i < max_diff - 1; i++) {
    count[i + 2] = count[i] + count[i + 1];
  }
  ull count_all = 1;
  for (auto &d : D) count_all *= count[d];
  std::cout << (count_all % 1000000007) << std::endl;
  return 0;
}
