#include <bits/stdc++.h>
int main() {
  long long N, M, i, j = 0, fib = 0, cnt = 0, min, ret = 1, ret2;
  long long a[100000], arr[100000];
  scanf("%lld %lld\n", &N, &M);
  for (i = 0; i < M; i++) {
    scanf("%lld\n", &a[i]);
  }
  for (i = 0; i <= N; i++) {
    if (i == 0 || i == 1) {
      arr[i] = 1;
    } else {
      arr[i] = arr[i - 1] + arr[i - 2];
    }
    if (a[i] == a[i + 1] - 1) {
      printf("0\n");
      return 0;
    }
  }
  min = a[j];
  for (i = 0; i < N; i++) {
    if (cnt == min) {
      ret *= arr[min - 1];
      if (a[j + 1] == 0) {
        ret *= arr[N - min - 1];
        ret2 = ret % 1000000007;
        printf("%lld\n", ret2);
        return 0;
      } else {
        min = a[j + 1];
      }
      cnt = 0;
    } else {
      cnt++;
    }
  }
  ret2 = ret % 1000000007;
  printf("%lld\n", ret2);
  return 0;
}
