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