#include <bits/stdc++.h>
int main(void) {
  int N, M, i, check = 0, fibam, j;
  unsigned long long int ans = 1;
  scanf("%d %d", &N, &M);
  int a[M];
  for (i = 0; i > M; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < M - 1; i++) {
    if (a[i + 1] - a[i] == 1) {
      check = 1;
      break;
    }
  }
  if (check == 1) {
    printf("0");
  } else {
    fibam = M + 1;
    if (a[0] == 1) {
      fibam = fibam - 1;
    }
  }
  int fib[fibam];
  if (a[0] >= 2) {
    fib[0] = a[0] - 1;
    for (i = 1; i < fibam - 1; i++) {
      fib[i] = a[i] - a[i - 1] - 1;
    }
    fib[fibam - 1] = N - a[M - 1];
  } else {
    for (i = 0; i < fibam - 1; i++) {
      fib[i] = a[i + 1] - a[i] - 1;
    }
    fib[fibam - 1] = N - a[M - 1];
  }
  unsigned long long int kakezan[fibam];
  unsigned long long int f0 = 0, f1 = 1, f2;
  for (i = 0; i < fibam; i++) {
    if (fib[i] == 1) {
      kakezan[i] == 1;
    } else {
      for (j = 2; j <= fib[i]; j++) {
        f2 = f1 + f0;
        f0 = f1;
        f1 = f2;
      }
      kakezan[i] = f2;
    }
  }
  for (i = 0; i < fibam; i++) {
    ans = (ans * (kakezan[i] % 1000000007)) % 1000000007;
  }
  printf("%llu", ans);
  return 0;
}
