#include <bits/stdc++.h>
using namespace std;
vector<vector<long long>> comb(int n, int r) {
  vector<vector<long long>> v(n + 1, vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}
int main() {
  int n, m;
  int* a;
  cin >> n >> m;
  a = new int[m];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int currentStep = -1;
  int ans = 1;
  for (int i = 0; i < m; i++) {
    int mid = a[i] - currentStep - 1;
    if (mid == 0) cout << 0 << endl;
    int count = 1;
    for (int j = 1; j - mid < 2; j++) {
      count += comb(mid - j, j)[mid - j][j] % 1000000007;
    }
    ans *= count % 1000000007;
  }
}
