#include <bits/stdc++.h>
using namespace std;
int fibo(int num) {
  if (num < 3) return 1;
  int o = 1;
  int oo = 1;
  for (int n = 2; n < num; n++) {
    int res = o + oo;
    oo = o;
    o = res;
  }
  return o;
}
int main() {
  int N, M;
  cin >> N >> M;
  int a[M];
  for (int m = 0; m < M; m++) {
    cin >> a[m];
  }
  int fl = 0;
  vector<int> vec;
  vec.reserve(N + 1);
  vec.push_back(a[0]);
  for (int m = 1; m < M; m++) {
    if (a[m] - a[m - 1] == 1) fl = 1;
    vec.push_back(a[m] - a[m - 1] - 1);
  }
  vec.push_back(N - a[M - 1]);
  if (fl == 1) {
    cout << "0" << endl;
  } else {
    long long res = 1;
    for (int n = 0; n < vec.size(); n++) {
      int atai = fibo(vec[n]);
      res *= atai;
      res %= 1000000007;
    }
    cout << res << endl;
  }
}
