#include <bits/stdc++.h>
using namespace std;
int N, M, a[112345], fib[112345];
int main() {
  scanf("%d%d", &N, &M);
  a[0] = -1;
  for (long long i = 0; i < (M); ++i) scanf("%d", &a[i + 1]);
  for (long long i = 0; i < (M - 1); ++i) {
    if (a[i] + 1 == a[i + 1]) {
      printf("-1\n");
      return 0;
    }
  }
  fib[0] = 1;
  fib[1] = 1;
  for (long long i = 0; i < (N + 123); ++i) {
    fib[i + 2] = (fib[i] + fib[i + 1]) % 1000000007;
  }
  long long ans = 1;
  for (long long i = 0; i < (M); ++i) {
    if (a[i + 1] != a[i]) {
      ans *= fib[a[i + 1] - a[i] - 2];
      ans %= 1000000007;
    }
  }
  ans *= fib[N + 1 - a[M] - 2];
  ans %= 1000000007;
  printf("%lld\n", ans);
  return 0;
}
