#include using namespace std; const int MOD = 1000000007; int main() { int n, d; cin >> n >> d; vector dp(n + 1, 0), sum(n + 2, 0); dp[0] = 1; sum[1] = 1; for (int i=1; i<=n; i++) { int l = max(0, i - d); dp[i] = (MOD + sum[i] - sum[l]) % MOD; sum[i + 1] = (sum[i] + dp[i]) % MOD; } cout << dp[n] << "\n"; }