#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
void cmax(T& a, U b) {
  if (a < b) a = b;
}
template <class T, class U>
void cmin(T& a, U b) {
  if (a > b) a = b;
}
int hoge(int n, int m, vector<int> a) {
  vector<int> dp(n + 1);
  dp[0] = 1;
  a.push_back(n + 1);
  const int MOD = 1000000007;
  int cnt = 0;
  for (long long i = 0; i < n; i++) {
    if (i + 1 == a[cnt]) {
      cnt++;
      continue;
    }
    if (i == 0) {
      dp[i + 1] = 1;
    } else {
      dp[i + 1] = (dp[i] + dp[i - 1]) % MOD;
    }
  }
  return dp[n];
}
int fibo(int n, int m, vector<int> a) {
  for (long long i = 0; i < m - 1; i++) {
    if (a[i + 1] == a[i]) {
      cout << 0 << endl;
      return 0;
    }
  }
  vector<int> fib(n + 1);
  fib[1] = 1;
  fib[2] = 1;
  for (long long i = 0; i < n; i++) {
    fib[i + 3] = fib[i + 2] + fib[i + 1];
  }
  const int MOD = 1e9 + 7;
  a.push_back(n + 1);
  int pre = -1;
  long long ans = 1;
  for (long long i = 0; i < m + 1; i++) {
    ans = (ans * fib[a[i] - pre - 1]) % MOD;
    pre = a[i];
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<int> a(m);
  for (long long i = 0; i < m; i++) cin >> a[i];
}
