#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, ans = 1;
  cin >> n >> m;
  vector<long long> a(m + 2), f(100000, 1);
  a.at(0) = -1;
  a.at(m + 1) = n + 2;
  for (int i = 1; i < m + 1; i++) {
    cin >> a.at(i);
  }
  for (int i = 2; i < 100000; i++) {
    f.at(i) = f.at(i - 2) + f.at(i - 1);
  }
  for (int i = 1; i < m + 2; i++) {
    if (a.at(i) == a.at(i - 1)) continue;
    if (a.at(i) - a.at(i - 1) - 1 == 0) {
      ans = 0;
      break;
    }
    ans *= f.at(a.at(i) - a.at(i - 1) - 2);
  }
  cout << ans % 1000000007;
}
