#include <bits/stdc++.h>
template <typename T>
T round_up(const T& a, const T& b) {
  return (a + (b - 1)) / b;
}
using ll = long long;
using namespace std;
ll mod = 1e9 + 7;
int main() {
  int N, M;
  cin >> N >> M;
  vector<int> dp(N + 2);
  vector<int> A(M);
  int pre = 0;
  bool flag = false;
  for (int i = 0; i < (M); ++i) {
    cin >> A[i];
  }
  dp[N + 1] = 0;
  dp[N] = 1;
  int index = M - 1;
  for (int i = N - 1; i >= 0; i--) {
    if (A[index] == i) {
      dp[i] = 0;
      index--;
      index += M;
      index %= M;
    } else {
      dp[i] = dp[i + 1] + dp[i + 2];
    }
    dp[i] %= mod;
  }
  cout << dp[0] << endl;
  return 0;
}
