#include <bits/stdc++.h>
using namespace std;
int count_step(int S, int E);
int main() {
  int N, M, check;
  cin >> N >> M;
  vector<int> A(M);
  int i;
  for (i = 0; i < M; i++) {
    cin >> A.at(i);
    if (A[i] - A[i - 1] == 1) {
      check = 1;
    }
  }
  if (check == 1) {
    cout << 0 << endl;
    return 0;
  }
  int count = 0;
  long long int ans = 1;
  int j = 0;
  while (j <= M) {
    if (j == 0) {
      count = count_step(0, A[j] - 1);
    } else if (j == M) {
      count = count_step(A[M - 1] + 1, N);
    } else {
      count = count_step(A[j - 1] + 1, A[j] - 1);
    }
    ans *= count;
    j++;
  }
  int an;
  an = ans % 1000000007;
  cout << an << endl;
}
int count_step(int S, int E) {
  int ans, a, b;
  if (E - S <= 1) {
    ans = 1;
  } else {
    a = count_step(S, E - 1);
    b = count_step(S, E - 2);
    ans = a + b;
  }
  return ans;
}
