#include <bits/stdc++.h>
using namespace std;
const long double EPS = 1e-9;
const long long mod = 1e9 + 7;
long long power_mod(long long a, long long power) {
  long long value = 1;
  while (power != 0) {
    if (power & 1) value = (value * a) % mod;
    a = (a * a) % mod;
    power = power >> 1;
  }
  return value % mod;
}
long long combination(long long n, long long r) {
  long long numerator = 1;
  long long denomenator = 1;
  for (int i = 0; i < r; i++) {
    (numerator *= long long(n - i)) %= mod;
    (denomenator *= power_mod(long long(i + 1), long long(mod - 2))) %= mod;
  }
  return (numerator * denomenator) % mod;
}
void init(long long patterns[], long long N) {
  patterns[0] = 1;
  patterns[1] = 1;
  for (int i = (2); i < (N + 1); i++) {
    patterns[i] = (patterns[i - 1] + patterns[i - 2]) % mod;
  }
}
int main(void) {
  long long N, M;
  cin >> N >> M;
  long long a[M];
  long long patterns[N + 1];
  long long answer = 1;
  init(patterns, N);
  for (int i = 0; i < M; i++) {
    cin >> a[i];
  }
  answer = (patterns[a[0] - 1] * answer) % mod;
  answer = (patterns[N - (a[M - 1] + 1)] * answer) % mod;
  for (int i = 0; i < M - 1; i++) {
    int idx = (a[i + 1] - 1) - (a[i] + 1);
    if (idx < 0) {
      answer = 0;
      break;
    }
    answer = (answer * patterns[idx]) % mod;
  }
  cout << answer << endl;
  return 0;
}
