#include #include using namespace std; const int MOD = 1e9 + 7; int main() { int K, N; cin >> K >> N; vector x(N); for (int i = 0; i < N; ++i) { cin >> x[i]; } vector dp(K + 1, 0); dp[0] = 1; for (int i = 0; i < K; ++i) { for (int j = 0; j < N; ++j) { int a = i + x[j]; if (a > K) { break; // a > K ならループを抜ける } dp[a] += dp[i]; dp[a] %= MOD; } } cout << dp[K] << endl; return 0; }