#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int x, y, mx;
  x = 0;
  cin >> y;
  int a[m + 1];
  mx = a[0] = y - 1;
  for (int i = 1; i < m; i++) {
    x = y;
    cin >> y;
    if (y - x < 2) {
      cout << 0;
      return 0;
    } else {
      a[i] = y - x - 2;
    }
    if (a[i] > mx) {
      mx = a[i];
    }
  }
  a[m] = n - y - 1;
  if (a[m] > mx) {
    mx = a[m];
  }
  int steps[mx + 1];
  steps[0] = steps[1] = 1;
  for (int i = 2; i <= mx; i++) {
    steps[i] = steps[i - 1] + steps[i - 2];
  }
  long long tot = 1;
  for (int i = 0; i < m + 1; i++) {
    tot = tot * (long long)steps[a[i]];
  }
  cout << tot % 1000000007;
  return 0;
}
