#include <bits/stdc++.h>
using namespace std;
int fib(int n, int m) {
  if (n == m) return 1;
  if (n == m + 1) return 1;
  return fib(n - 1, m) + fib(n - 2, m);
}
int main() {
  int i, j, m, n, sum = 1;
  scanf("%d %d", &n, &m);
  int a[m], b[n], v[m];
  for (i = 0; i < n; i++) b[i] = 0;
  for (i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    b[a[i]] = 1;
  }
  for (i = 1; i < n; i++) {
    if (b[i] == 1 && b[i - 1] == 1) {
      printf("0\n");
      return 0;
    }
  }
  sort(a, a + m);
  j = 0;
  for (i = 0; i < m; i++) {
    if (b[a[i]] == 1) {
      sum *= fib(a[i] - 1, j);
      j = a[i] + 1;
    }
  }
  sum *= fib(n, j);
  printf("%d\n", sum % 1000000007);
  return 0;
}
