#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N, M, tmp, _max = 0, count = 0;
  long long result = 1;
  scanf("%d%d", &N, &M);
  vector<int> A(N, 1);
  vector<int> q;
  for (int i = 0; i < M; i++) {
    scanf("%d", &tmp);
    A[tmp - 1] = 0;
  }
  for (const auto &e : A) {
    if (e == 0) {
      if (count == -1) {
        cout << 0 << endl;
        return 0;
      } else {
        q.push_back(max(count, 1));
        count = -1;
      }
    } else {
      count++;
    }
  }
  if (count > 0) {
    q.push_back(count);
    count = -1;
  }
  sort(q.begin(), q.end());
  _max = q.back();
  vector<long long> fibonacci(_max);
  fibonacci[0] = 1;
  fibonacci[1] = 2;
  for (int i = 2; i < _max; i++)
    fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2];
  for (const auto &e : q) result = result * fibonacci[e - 1] % 1000000007;
  cout << result << endl;
  return 0;
}
