#include <iostream>
#include <vector>
#include <map>
#define rep(i, a, n) for(int i =  a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    int n, m;
    cin >> n >> m;
    map<int, int> mp;
    mp[0] = 1;
    rep(i, 1, n+1){
        mp[i] = 1;
    }
    int k;
    rep(i, 0, m){
        cin >> k;
        mp[k] = 0;
    }
    ll ans = 1;
    ll mod = 1000000007;
    rep(i, 2, n){
        if(mp[i-2] == 0 && mp[i-1] == 0){
            cout << 0 << endl;
            return 0;
        }
        else if(mp[i-2] == 1 && mp[i-1] == 1){
            ans *= 2
        }
    }
    cout << ans % 1000000007 << endl;
    return 0;
}
