#include <bits/stdc++.h>
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cout << name << " : " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
using namespace std;
long long n, a[100005], ans, m;
long long dp[100005];
long long f(long long i, long long j) {
  if (i == n) return 1;
  if (dp[i] != -1) return dp[i];
  long long val = 0;
  if (i + 1 != a[j] && i + 1 <= n) {
    if (i + 1 > a[j])
      val = (val + f(i + 1, j + 1)) % 1000000007;
    else
      val = (val + f(i + 1, j)) % 1000000007;
  }
  if (i + 2 != a[j] && i + 2 <= n) {
    if (i + 1 > a[j])
      val = (val + f(i + 2, j + 1)) % 1000000007;
    else
      val = (val + f(i + 2, j)) % 1000000007;
  }
  return dp[i] = val;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long i, j, k, cnt = 0, t = 1;
  cin >> n >> m;
  for (i = 0; i < m; i++) cin >> a[i];
  for (i = 0; i < m - 1; i++) {
    if (a[i + 1] - a[i] == 1) return cout << 0, 0;
  }
  memset(dp, -1, sizeof(dp));
  return cout << f(0, 0), 0;
  return 0;
}
