#include <bits/stdc++.h>
using namespace std;
void _126() {
  int n, k;
  cin >> n >> k;
  double probability = 0.0;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0;; ++j) {
      if (i * pow(2, j) >= k) {
        probability += (pow(0.5, j)) / n;
        break;
      }
    }
  }
  cout << fixed << setprecision(12);
  cout << probability << endl;
}
void _127() {
  int n, m, limit_l, limit_r, l, r;
  cin >> n >> m;
  limit_l = 1;
  limit_r = n;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r;
    if (l > limit_l) {
      limit_l = l;
    }
    if (r < limit_r) {
      limit_r = r;
    }
  }
  int count = max(limit_r - limit_l + 1, 0);
  cout << count << endl;
}
void _128() {
  int n, m;
  cin >> n >> m;
  int k[10], s[10][10];
  for (int i = 0; i < m; ++i) {
    cin >> k[i];
    for (int j = 0; j < k[i]; ++j) {
      cin >> s[i][j];
    }
  }
  int p[10];
  for (int i = 0; i < m; ++i) cin >> p[i];
  int count = 0;
  bool off_flag = false;
  int sw_count = 0;
  for (int i = 0; i < pow(2, n); ++i) {
    off_flag = false;
    for (int j = 0; j < m; ++j) {
      sw_count = 0;
      for (int l = 0; l < k[j]; ++l) {
        if (((i >> (s[j][l] - 1)) & 1) == 1) {
          sw_count++;
        }
      }
      if (sw_count % 2 != p[j]) {
        off_flag = true;
        break;
      }
    }
    if (!off_flag) {
      count++;
    }
  }
  cout << count << endl;
}
void _129() {
  int n, m;
  cin >> n >> m;
  int a[200000];
  bool failure = false;
  for (int i = 0; i < m; ++i) {
    cin >> a[i];
    if (i > 0 && a[i] == a[i - 1] + 1) {
      failure = true;
    }
  }
  if (failure) {
    cout << 0 << endl;
    return;
  }
  long long count = 1;
  long long count_m1 = 1;
  long long count_m2 = 1;
  int j = 0;
  if (a[j] == 1) {
    count_m1 = 0;
    ++j;
  }
  for (int i = 2; i <= n; ++i) {
    if (i == a[j]) {
      count = 0;
      ++j;
    } else {
      count = count_m1 + count_m2;
    }
    count_m2 = count_m1;
    count_m1 = count;
  }
  cout << count % 1000000007 << endl;
}
int main() {
  _129();
  return 0;
}
