#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[m];
  int i;
  long ans = 0;
  int chk = 0;
  int stp[n + 1];
  cin >> a[0];
  for (i = 1; i < m; i++) {
    cin >> a[i];
    if (a[i] == a[i - 1] + 1) {
      chk = 1;
    }
  }
  if (chk == 0) {
    stp[0] = 1;
    stp[1] = 1;
    stp[2] = 2;
    for (i = 3; i < n; i++) {
      stp[i] = stp[i - 1] + stp[i - 2];
    }
    ans = stp[a[0] - 1];
    for (i = 1; i < m; i++) {
      ans *= stp[a[i] - a[i - 1] - 2];
      if (ans >= 1000000007) ans = ans % 1000000007;
    }
  }
  cout << ans;
}
