#include <bits/stdc++.h>
using namespace std;
int part[100000];
long long int kaidansu1(int n, int s[100000]) {
  int i = 0;
  int msum = 0;
  int ans;
  if (n == 2) {
    part[0] = 2;
    ans = 1;
  } else if (n == 3) {
    part[1] = 3;
    ans = 3;
  } else {
    for (int k = 2; k < n - 1; k++) {
      part[k] = part[k - 1] + part[k - 2];
      if (k == s[k]) msum += part[k];
      if (k == n - 2) {
        ans = part[k] - msum;
      }
    }
  }
  return ans;
}
int a[100000];
int main(void) {
  int N, M;
  int i;
  int count[1000000] = {0};
  cin >> N >> M;
  for (i = 0; i < M; i++) {
    cin >> a[i];
    count[a[i]]++;
  }
  if (count[a[i]] == 2) {
    printf("0");
    return 0;
  } else {
    printf("%lld", kaidansu1(N, a) % 1000000007);
  }
  return 0;
}
