#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[m + 2];
  long long int a_sum[m + 2];
  a[m + 1] = n;
  a_sum[0] = 1;
  a[0] = 0;
  for (int i = 1; i < m + 1; i++) {
    cin >> a[i];
    if (a[i] == a[i - 1] + 1) {
      cout << 0 << endl;
      return 0;
    }
    a_sum[i] = a_sum[i - 1] * pow(2, (a[i] - a[i - 1] - 1) / 2) +
               (a[i] - a[i - 1] - 1) % 2;
    cout << a_sum[i] << endl;
  }
  a_sum[m + 1] =
      a_sum[m] * pow(2, (a[m + 1] - a[m] - 1) / 2) + (a[m + 1] - a[m] - 1) % 2;
  cout << a_sum[m + 1] % 1000000007 << endl;
  return 0;
}
