#include <bits/stdc++.h>
using namespace std;
long long func(int start, int end) {
  int a = 0;
  if (start == end) {
    a++;
  } else {
    if (start < end) {
      a += func(start + 1, end);
      a += func(start + 2, end);
    }
  }
  return a;
}
int main() {
  int n, m;
  cin >> n >> m;
  int a[100000];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  queue<int> que;
  for (int i = 0; i < m; i++) {
    que.push(a[i]);
  }
  que.push(n + 1);
  int start = -1;
  int end = 0;
  long long ans = 1;
  while (que.size()) {
    end = que.front();
    que.pop();
    if (end - start == 1) {
      cout << 0 << endl;
      return 0;
    } else if (end - start > 2) {
      int a = func(start + 1, end - 1);
      ans *= a;
    }
    start = end;
  }
  ans = ans % 1000000007;
  cout << ans << endl;
  return 0;
}
