#include <bits/stdc++.h>
using namespace std;
long long fib(long long s) {
  if (s == 1) {
    return 1;
  } else if (s == 2) {
    return 2;
  } else {
    long long a = 1, b = 2, r = 1;
    for (int i = 2; i < s; i++) {
      r = a + b;
      a = b;
      b = r;
    }
    return r;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  long long ans = 1, c = -1;
  for (int i = 0; i < m; i++) {
    if (i < m - 1) {
      if (a.at(i) == a.at(i + 1) - 1) {
        ans = 0;
        break;
      }
    }
    if (a.at(i) == 1) {
      if (m == 1) {
        ans = 0;
        break;
      }
      c = 1;
      continue;
    }
    long long s = a.at(i) - c - 2;
    c = a.at(i);
    long long an = fib(s);
    ans = (ans * an) % 1000000007;
    if (i == m - 1) {
      s = n - c - 1;
      an = fib(s);
      ans = (ans * an) % 1000000007;
    }
  }
  cout << ans << endl;
  return 0;
}
