#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9;
long long fib(int n) {
  long long f0 = 1, f1 = 2;
  if (n == 1) {
    return 1;
  }
  for (int i = 2; i < n; i++) {
    long long temp = f1;
    f1 += f0;
    f0 = temp;
  }
  return f1;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(M + 1);
  a[0] = 0;
  for (int i = 1; i <= M; i++) {
    cin >> a[i];
  }
  for (int i = 1; i < M; i++) {
    if (a[i + 1] - a[i] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long sum = 1;
  int ptr = 1;
  long long temp;
  int cnt;
  for (int i = 1; i <= M; i++) {
    cnt = 1;
    while (ptr < a[i]) {
      temp = fib(cnt);
      ptr++;
      cnt++;
    }
    sum = ((sum % 1000000007) * (temp % 1000000007)) % 1000000007;
    ptr++;
  }
  cnt = 1;
  while (ptr < N) {
    temp = fib(cnt);
    ptr++;
    cnt++;
  }
  sum = ((sum % 1000000007) * (temp % 1000000007)) % 1000000007;
  cout << sum % 1000000007 << endl;
}
