#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  srand(time(NULL));
  ;
  int n, m;
  cin >> n >> m;
  vector<long long> a;
  long long b[100001];
  b[0] = 0;
  b[1] = 1;
  b[2] = 1;
  for (int i = 3; i < 100001; i++) {
    b[i] = (b[i - 1] + b[i - 2]) % 1000000007;
  }
  cout << b[100000] << endl;
  for (int i = 0; i < m; i++) {
    int a1;
    cin >> a1;
    a.push_back(a1);
  }
  vector<int> c;
  long long ans = 1;
  c.push_back(a[0]);
  for (int i = 1; i < m; i++) {
    c.push_back(a[i] - a[i - 1] - 1);
  }
  c.push_back(n - a[m - 1]);
  for (int i = 0; i < c.size(); i++) {
    ans *= b[c[i]];
    ans %= 1000000007;
  }
  cout << ans;
  return 0;
}
