#include <bits/stdc++.h>
const long long mod = 1e9 + 7;
using namespace std;
long long n, m, k, sum, ans;
const int maxn = 1e5 + 5;
long long a[maxn];
long long dp[maxn];
int main() {
  dp[0] = 1;
  dp[1] = 1;
  dp[2] = 2;
  for (int i = 3; i < maxn; i++) {
    dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
  }
  scanf("%lld%lld", &n, &m);
  for (long long i = 1; i <= m; i++) {
    scanf("%lld", &a[i]);
  }
  long long sum = 1;
  sum = dp[a[1] - 1];
  for (long long i = 2; i <= m; i++) {
    if (a[i] == a[i - 1] || (a[i] - a[i - 1] - 2) == 0) continue;
    if (a[i] - a[i - 1] == 1) {
      printf("0\n");
      return 0;
    } else {
      sum = (sum * dp[a[i] - a[i - 1] - 2]) % mod;
    }
  }
  sum = (sum * dp[n - a[m] - 1]) % mod;
  printf("%lld\n", sum);
}
