#include <bits/stdc++.h>
using namespace std;
long long ookii = 1000000007;
int main() {
  int N, M;
  cin >> N >> M;
  int a[N];
  for (int i = 0; i < N; i++) {
    a[i] = 0;
  }
  for (int i = 0; i < M; i++) {
    int t;
    cin >> t;
    a[t] = 1;
  }
  long long ret = 0;
  long long ret1 = 1;
  long long ret2 = 0;
  for (int i = 1; i < N; i++) {
    ret = ret2 + ret1;
    if (a[i] == 1) ret = 0;
    cout << ret2 << " " << ret1 << " " << ret << endl;
    ret %= ookii;
    ret2 = ret1;
    ret1 = ret;
  }
  cout << (ret1 + ret2) % ookii << endl;
}
void cheatsheet() {
  vector<int> vecloop;
  for (int i = 0; i < 10; i++) {
    vecloop.push_back(i);
  }
  int a = 1;
  int b = 5;
  swap(a, b);
  int arr[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
  sort(arr, arr + 9, greater<int>());
  vector<int> vec(arr, end(arr));
  sort(vec.begin(), vec.end());
  cout << lower_bound(vec.begin(), vec.end(), 2)[0];
  map<pair<long long, long long>, long long> m;
  m[pair<long long, long long>(10, 100)] = 100;
}
