#include <bits/stdc++.h>
int dp(int n) {
  if (n == 1) {
    return 1;
  } else if (n == 2) {
    return 1;
  } else if (n == 3) {
    return 2;
  } else if (n >= 4) {
    return dp(n - 1) + dp(n - 2);
  } else {
    printf("dp() seems has the problem\n");
    return 0;
  }
}
int main() {
  int i, j, N, M;
  int a[100000];
  unsigned long sum = 0;
  int current = 0;
  int numOfSteps = 0;
  int flg = 0;
  scanf("%d %d", &N, &M);
  for (i = 0; i < M; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 1; i < M; i++) {
    if (a[i] - a[i - 1] == 1) {
      printf("0\n");
      return 0;
    }
  }
  current = 0;
  sum = 1;
  for (i = 0; i <= N; i++) {
    for (j = current; j < M; j++) {
      if (i == a[j]) {
        sum *= dp(numOfSteps);
        sum = sum % 1000000007;
        flg = 1;
        current++;
      }
    }
    if (flg == 1) {
      flg = 0;
      numOfSteps = 0;
    } else {
      numOfSteps++;
    }
  }
  if (numOfSteps != 0) {
    sum *= dp(numOfSteps);
    sum = sum % 1000000007;
  }
  printf("%lu\n", sum);
  return 0;
}
