#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long binary_method(long long a, long long b) {
  if (b == 0) return (long long)1;
  long long temp = binary_method(a, b >> 1);
  if (b % 2 == 1)
    return (((temp * temp) % mod) * a) % mod;
  else
    return (temp * temp) % mod;
}
long long inv(long long a) { return binary_method(a, mod - 2); }
long long solve(long long n) {
  if (n == -1) return 0;
  if (n == 0) return (long long)1;
  long long ans = 1;
  long long temp = 1;
  for (int i = 1; i < n / 2 + 1; i++) {
    long long bunshi = ((n - 2 * i + 1) * (n - 2 * i + 2)) % mod;
    long long bunbo = ((n - i + 1) * i) % mod;
    temp = (((temp * bunshi) % mod) * inv(bunbo)) % mod;
    ans += temp;
  }
  return ans;
}
int main() {
  int N, M;
  cin >> N >> M;
  if (M == 0) {
    cout << solve(N) << endl;
    return 0;
  }
  int *a = new int[M];
  for (int i = 0; i < M; i++) cin >> a[i];
  int *start = new int[M + 1];
  int *end = new int[M + 1];
  start[0] = 0;
  for (int i = 0; i < M; i++) start[i + 1] = a[i] + 1;
  for (int i = 0; i < M; i++) end[i] = a[i] - 1;
  end[M] = N;
  long long ans = 1;
  for (int i = 0; i < M + 1; i++) {
    ans = (ans * solve(end[i] - start[i])) % mod;
  }
  cout << ans << endl;
  delete[] a;
  delete[] start;
  delete[] end;
  return 0;
}
