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