#include <bits/stdc++.h>
using namespace std;
int f(int n) {
  if (n == 1)
    return 1;
  else if (n == 2)
    return 2;
  else if (n == 0)
    return 1;
  else
    return f(n - 1) + f(n - 2);
}
int main(void) {
  long long N, M;
  cin >> N >> M;
  long long a[M];
  for (int(i) = 0; (i) < (M); (i)++) cin >> a[i];
  bool jud = false;
  for (int t = 1; t < M; t++) {
    if (a[t - 1] - a[t] == 1 || a[t - 1] - a[t] == -1) jud = true;
  }
  if (jud)
    cout << 0;
  else {
    long long b[M + 1];
    long long sum = 1;
    b[0] = f(a[0] - 1);
    for (int k = 1; k < M; k++) {
      b[k] = f(a[k] - a[k - 1] - 1);
    }
    b[M] = f(N - a[M - 1] - 1);
    for (int saigo = 0; saigo < M + 1; saigo++) {
      sum *= b[saigo];
    }
    cout << sum % 1000000007;
  }
}
