N,L=map(int,input().split()) mod=10**9+7 DP=[0]*(N+L+5) DP[0]=1 for i in range(N): DP[i]+=DP[i-1] DP[i]%=mod x=DP[i] DP[i+1]+=x DP[i+L+1]-=x print(DP[N]%mod)