#include <bits/stdc++.h>
using namespace std;
int fiv(int x) {
  long long current = 1;
  long long next = 1;
  for (int i = 0; i < x; i++) {
    long tmp = current;
    current = next;
    next += tmp;
  }
  return current;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (int i = 0; i < m; i++) {
    cin >> a.at(i);
  }
  long long count = fiv(a.at(0) - 1);
  count *= fiv(n - a.at(m - 1) - 1);
  int flag = 1;
  for (int i = 1; i < m; i++) {
    if (a.at(i) - a.at(i - 1) == 1) {
      count = 0;
      flag = 0;
      break;
    }
  }
  if (flag == 0) {
    cout << count << endl;
    return 0;
  }
  for (int i = 0; i < m - 1; i++) {
    if (a.at(i + 1) - a.at(i) != 2) {
      count *= fiv(a.at(i + 1) - a.at(i) - 2);
      cout << fiv(a.at(i + 1) - a.at(i) - 2) << endl;
    }
  }
  cout << count % 1000000007 << endl;
}
