#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, n, m, a[100004], s[99999], S = 1, tmp[99999];
  cin >> n >> m;
  a[0] = -1;
  a[m + 1] = n + 1;
  for (i = 1; i <= m; i++) {
    cin >> a[i];
  }
  for (i = 1; i <= m + 1; i++) {
    tmp[0] = 1;
    s[i] = 1;
    for (j = 1; j < a[i] - a[i - 1] - 2; j++) {
      tmp[j] = s[i];
      s[i] += tmp[j - 1];
    }
    if (a[i] == a[i - 1] + 1) {
      cout << 0;
      return 0;
    }
  }
  for (i = 1; i <= m + 1; i++) S = (S * s[i]) % 1000000007;
  cout << S;
  return 0;
}
