#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll pattern(int len) {
  if (len == 1) return 1;
  if (len == 2) return 2;
  ll ret = 0;
  for (size_t i = 0; i < len - 1; ++i) {
    ret += pattern(i) + pattern(len - (i + 2));
  }
  return ret;
}
int main() {
  int n;
  int m;
  cin >> n;
  cin >> m;
  vector<int> a(m + 2);
  a.at(0) = 0;
  for (size_t i = 1; i < m + 1; ++i) {
    int tmp;
    cin >> tmp;
    a.at(i) = tmp;
  }
  a.at(m + 1) = n;
  vector<ll> lens;
  ll return_value = 1;
  for (size_t i = 0; i < m + 1; ++i) {
    lens.push_back(pattern(a.at(i + 1) - 1 - a.at(i)));
  }
  for (size_t i = 0; i < m + 1; ++i) {
    return_value = return_value * lens.at(i) % 1000000007;
  }
  cout << return_value << endl;
  return 0;
}
