#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M, s, num = 0;
  long long int count = 1;
  cin >> N >> M;
  vector<int> f;
  vector<int> dif(M + 1, 0);
  vector<int> ans(N + 1, 0);
  cin >> s;
  f.push_back(s);
  for (int i = 1; i < M; i++) {
    cin >> s;
    f.push_back(s);
    if (f[i] - f[i - 1] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  for (int i = 0; i < f.size(); i++) {
    if (i == 0) {
      dif[0] = f[0] - 1;
    } else {
      dif[i] = f[i] - f[i - 1] - 2;
    }
  }
  dif[M] = N - f[M - 1] - 1;
  for (int i = 0; i < dif.size(); i++) {
    if (dif[i] == 1) {
      dif[i] = 0;
    }
  }
  ans[0] = 1;
  ans[1] = 1;
  sort(dif.begin(), dif.end());
  for (int i = 2; i <= dif[M]; i++) {
    ans[i] = ans[i - 1] + ans[i - 2];
  }
  for (int i = 0; i < dif.size(); i++) {
    count *= ans[dif[i]];
  }
  cout << count % 1000000007 << endl;
  return 0;
}
