#include <bits/stdc++.h>
using namespace std;
long long int N, M;
long long int a[1000000];
const long long int val = 1000000007;
int main(void) {
  cin >> N >> M;
  for (long long int i = 0; i < M; i++) cin >> a[i];
  sort(a, a + M);
  if (M > 0) N -= 2;
  for (long long int i = 1; i < M; i++) {
    N -= 2;
    if (a[i] - a[i - 1] == 2) N++;
    if (a[i] - a[i - 1] == 1) {
      cout << 0 << endl;
      return 0;
    }
  }
  long long int an = 1;
  long long int bn = 1;
  for (long long int i = 0; i < N - 2; i++) {
    an += bn;
    bn++;
    an %= val;
  }
  cout << an << endl;
  return 0;
}
