#include <bits/stdc++.h>
using namespace std;
long long fivo(int n) {
  if (n == 1 || n == 2)
    return 1;
  else
    return fivo(n - 1) + fivo(n - 2);
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m), sa(m + 1);
  for (int i = 0; i < m; i++) cin >> a[i];
  long long ans = 1;
  bool flag = true;
  for (int i = 0; i < m - 1; i++) {
    if (a[i + 1] - a[i] == 1) {
      flag = false;
      break;
    }
  }
  if (!flag)
    cout << 0;
  else {
    sa[0] = a[0];
    sa[m] = n - a[m - 1];
    for (int i = 1; i < m; i++) sa[i] = a[i] - a[i - 1] - 1;
    for (int i = 0; i < m + 1; i++) {
      ans *= fivo(sa[i]);
    }
    cout << ans % 1000000007;
  }
}
