#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll kaizyo(ll k) {
  ll sum = 1;
  for (ll i = 1; i <= k; ++i) {
    sum *= i;
  }
  return sum;
}
ll f(ll a) {
  ll ret = 0;
  ll o, t;
  for (ll i = 0; i <= a / 2; i++) {
    o = a - i * 2;
    t = i;
    ret += kaizyo((o + t)) / kaizyo(o) / kaizyo(t);
  }
  return ret;
}
int main() {
  ll n, m;
  ll ans = 1;
  vector<ll> a(m + 1);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= m; i++) {
    if (a[i] + 1 == a[i + 1]) {
      cout << 0 << endl;
      return 0;
    }
  }
  a[0] = -1;
  for (int i = 0; i < (m); ++i) {
    cout << i << " " << f((a[i + 1] - 1) - (a[i] + 1)) << endl;
    ans *= f((a[i + 1] - 1) - (a[i] + 1));
    ans %= 1000000007;
  }
  ans *= f(n - a[m] - 1);
  ans %= 1000000007;
  cout << ans << endl;
}
