#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair < int, int > ii;
const int N = 1e6 + 5;
const int mod = 1e9 + 7;
int n, m;
int a[N], sum[N], dp[N], sumDp[N];
inline int add(int x, int y) {
return x + y >= mod ? x + y - mod : x + y;
}
int main() {
scanf("%d %d", &n, &m);
for(int i = 1; i <= m; i++) {
int x;
scanf("%d", &x);
a[x]++;
}
for(int i = 1; i <= n; i++)
sum[i] = sum[i - 1] + a[i];
dp[n + 1] = 1;
int ans = 0;
sumDp[n + 2] = 1;
sumDp[n + 1] = 1;
for(int i = n; i >= 1; i--) {
if(!a[i-1])
for(int j = i; j <= n; j++) {
if(j - i + 1 == sum[j] - sum[i - 1] and !a[j + 1]) {
dp[i] = add(dp[i], sumDp[j + 2]);
}
}
if(a[i])
ans = 0;
ans = add(ans, dp[i]);
if(a[i])
sumDp[i] = dp[i];
else
sumDp[i] = add(sumDp[i + 1], dp[i]);
}
printf("%d\n", ans);
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKdHlwZWRlZiBsb25nIGxvbmcgbGw7CnR5cGVkZWYgcGFpciA8IGludCwgaW50ID4gaWk7Cgpjb25zdCBpbnQgTiA9IDFlNiArIDU7CmNvbnN0IGludCBtb2QgPSAxZTkgKyA3OwoKaW50IG4sIG07CmludCBhW05dLCBzdW1bTl0sIGRwW05dLCBzdW1EcFtOXTsKCmlubGluZSBpbnQgYWRkKGludCB4LCBpbnQgeSkgewoJcmV0dXJuIHggKyB5ID49IG1vZCA/IHggKyB5IC0gbW9kIDogeCArIHk7Cn0KCmludCBtYWluKCkgewoKCXNjYW5mKCIlZCAlZCIsICZuLCAmbSk7CgoJZm9yKGludCBpID0gMTsgaSA8PSBtOyBpKyspIHsKCQlpbnQgeDsKCQlzY2FuZigiJWQiLCAmeCk7CgkJYVt4XSsrOwoJfQoKCWZvcihpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKQoJCX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