#include using namespace std; #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") const int mod = 1000000007; int K, N, X[100009]; long long dp[100009]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); cin >> K >> N; int mx = 0; for (int i = 0; i < N; ++i) { cin >> X[i]; if (X[i] == i + 1) mx = i + 1; } if (mx >= K - 1) { int ans = 1; for (int i = 1; i < K; ++i) { ans = 2 * ans % mod; } if (mx == K - 1) --ans; cout << ans << endl; return 0; } dp[0] = 1; for (int i = 1; i <= K; ++i) { for (int j = 0; j < N && X[j] <= i; ++j) { dp[i] += dp[i - X[j]]; } dp[i] %= mod; } cout << dp[K] << endl; return 0; }