#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
const long long MOD = 1000000007;
long long mod_fib(long long num) {
  if (num == 0)
    return 0;
  else if (num <= 2)
    return 1;
  return (mod_fib(num - 2) + mod_fib(num - 1)) % MOD;
}
int main() {
  int N, M;
  cin >> N >> M;
  vector<long long> group;
  int before = 0;
  for (int i = 0; i < (M); ++i) {
    int a;
    cin >> a;
    group.emplace_back(a - before);
    before = a + 1;
    if (i == M - 1) {
      group.emplace_back(N - a);
    }
  }
  if (M == 0) {
    group.emplace_back(N);
  }
  long long result = 1;
  for (int i = 0; i < (group.size()); ++i) {
    if (group[i] == 0) {
      cout << 0 << endl;
      return 0;
    } else {
      result *= mod_fib(group[i]);
      result %= MOD;
    }
  }
  cout << result << endl;
  return 0;
}
