#include <bits/stdc++.h>
push(),
    top()
    : to get data,
      pop()
    : to remove, size(), empty() * ** / using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  int a[M];
  unsigned long ans = 0;
  for (int i = 0; i < M; i++) cin >> a[i];
  for (int i = 0; i < M - 1; i++) {
    if (a[i + 1] == a[i] + 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  unsigned long b[2] = {};
  int num = 0;
  if (a[0] != 1)
    b[0] = 1;
  else
    num++;
  if (a[num] != 2)
    b[1] = b[0] + 1;
  else
    num++;
  if (N >= 3) {
    for (int i = 2; i < N; i++) {
      if (a[num] != i + 1) {
        ans = b[1] + b[0];
        b[0] = b[1];
        b[1] = ans;
      } else {
        b[0] = b[1];
        b[1] = 0;
        num++;
      }
      if (b[1] > 1000000007 && b[0] > 1000000007) {
        b[1] -= 1000000007;
        b[0] -= 1000000007;
      } else if (b[1] == 0 && b[0] > 1000000007) {
        b[0] -= 1000000007;
      } else if (b[0] == 0 && b[1] > 1000000007) {
        b[1] -= 1000000007;
      }
    }
  } else if (N == 1) {
    cout << b[1] << endl;
    return 0;
  } else {
    cout << b[0] << endl;
    return 0;
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
