#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
void solve(long long N, long long M, vector<long long> a) {
  vector<long long> l;
  l.push_back(a[0]);
  for (int i = 1; i < M; i++) {
    if (a[i] == a[i - 1]) {
      continue;
    }
    l.push_back(a[i] - a[i - 1] - 1);
  }
  l.push_back(N - a[M - 1]);
  vector<long long> fib(3);
  fib[0] = 0;
  fib[1] = 1;
  fib[2] = 1;
  for (int i = 0; i < N; i++) {
    fib.push_back((fib[i + 1] + fib[i + 2]) % mod);
  }
  long long ans = 1;
  for (int i = 0; i < l.size(); i++) {
    ans *= fib[l[i]];
    ans %= mod;
  }
  std::cout << ans << std::endl;
}
int main() {
  long long N;
  long long M;
  scanf("%lld", &N);
  scanf("%lld", &M);
  vector<long long> a(M);
  for (int i = 0; i < M; i++) {
    scanf("%lld", &a[i]);
  }
  solve(N, M, a);
  return 0;
}
