N, L = map(int, input().split()) MOD = 10**9 + 7 fib = [0] * (N + 1) AAC = [0] fib[0] = 1 AAC.append(1) for i in range(1, N + 1): # fib[i] = sum(fib[max(0, i - L):i]) % MOD fib[i] = AAC[-1] - AAC[max(0, i - L)] fib[i] %= MOD AAC.append(AAC[-1] + fib[i]) AAC[-1] %= MOD print(fib[-1])