#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>

using ll = long long;
using namespace std;
vector<ll> memo(100'001);

void init() {
    memo[0] = 1;
    memo[1] = 1;
    for (int i = 2; i < 100001; i++) {
        memo[i] = memo[i - 1] + memo[i - 2];
    }
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> a(M);
    for (int i = 0; i < M; i++) {
        cin >> a[i];
    }
    init();

    vector<int> b;
    int cur = a[0];
    int index = 0;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
        if (i == cur) {
            if (cnt == 0) {
                cout << 0 << endl;
                return 0;
            }
            index++;
            b.emplace_back(cnt);
            cnt = 0;
            if (index >= M)continue;
            cur = a[index];
        }
        else {
            cnt++;
        }
    }

    b.emplace_back(++cnt);

    ll ans = 1;
    int mod = 1'000'000'007;
    int size = b.size();
    for (int i = 0; i < size; i++) {
        ans *= memo[b[i] - 1];
        ans %= mod;
    }

    cout << ans << endl;
    return 0;
}
