#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
template <typename T>
void ndarray(vector<T> &vec, int len) {
  vec.resize(len);
}
template <typename T, typename... Args>
void ndarray(vector<T> &vec, int len, Args... args) {
  vec.resize(len);
  for (auto &v : vec) ndarray(v, args...);
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < (m); ++i) cin >> a[i];
  int dp[n + 1];
  for (int i = 0; i < (n + 1); ++i) dp[i] = 1;
  dp[a[0]] = 0;
  for (int i = 1; i < m; ++i) {
    dp[a[i]] = 0;
    if (a[i] == a[i - 1]) {
      cout << 0 << "\n";
      return 0;
    }
  }
  for (int i = 1; i < n; ++i) {
    if (dp[i + 1] == 0) continue;
    dp[i + 1] = ((dp[i] % 1000000007) + (dp[i - 1] % 1000000007));
    dp[i + 1] = dp[i + 1] % 1000000007;
  }
  cout << dp[n] << "\n";
  return 0;
}
