#include <bits/stdc++.h>
int main(void) {
  long long n, m, a[200005], sum = 0, mod = 1000000007, h[200005], jud;
  scanf("%lld %lld", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    h[a[i]] = 0;
  }
  for (int i = 1; i <= n; i++) {
    if (a[i] == 1) jud = -1;
    if (a[i] == 2) jud = 1;
    if ((a[i] == 1) && (a[i] == 2)) {
      printf("0\n");
      return 0;
    }
  }
  if (jud == -1) h[1] = 0;
  h[2] = 1;
  if (jud == 1) h[1] = 1;
  h[2] = 0;
  for (int i = 1; i <= n - 2; i++) {
    if (h[i + 2] == 0) continue;
    h[i + 2] = h[i + 1] + h[i];
    h[i + 2] %= mod;
  }
  printf("%lld\n", h[n]);
  return 0;
}
