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