#include <bits/stdc++.h>
using namespace std;
long long f(int a) {
  vector<long long> A(a + 1);
  if (a > 2) {
    A.at(0) = 0;
    A.at(1) = 1;
    A.at(2) = 1;
    A.at(3) = 2;
    for (int i = 4; i <= a; i++) {
      A.at(i) = A.at(i - 1) + A.at(i - 2);
      if (A.at(i) > 1000000007) {
        A.at(i) -= 1000000007;
      }
    }
    return A.at(a);
  } else {
    return a;
  }
}
int main() {
  int N, M;
  long ans = 1;
  cin >> N >> M;
  vector<int> k(M);
  for (int i = 0; i < M; i++) {
    cin >> k.at(i);
  }
  vector<int> K(M + 1);
  for (int i = 1; i < M; i++) {
    K.at(i) = k.at(i) - k.at(i - 1) - 1;
  }
  K.at(0) = k.at(0);
  K.at(M) = N - k.at(M - 1);
  for (int i = 0; i <= M; i++) {
    ans *= f(K.at(i));
    if (ans > 1000000007) {
      ans = ans % 1000000007;
    }
  }
  cout << ans;
}
