1 #include <cstdio>
2 #include <iostream>
3 #include <cstring>
4 #include <algorithm>
5 #include <cmath>
6 #include <cctype>
7 using namespace std;
8
9 #define LL long long
10 #define res register int
11
12 const int N=100000+5,mod=1e9+7;
13 int f[N],n,k;
14
15 int main()
16 {
17 freopen("debug.in","r",stdin);
18 freopen("debug.out","w",stdout);
19 scanf("%lld %lld",&n,&k);
20 f[0]=1;
21 for(res i=1 ; i<=n ; i++)
22 {
23 f[i]=f[i-1];
24 if(i>=k) f[i]=(f[i]+f[i-k])%mod;
25 else f[i]=(f[i]+1)%mod;
26 }
27 if(n-2k+1<0) ans=(f[n-k]-1)%mod;
28 int ans=(f[n-k]+(LL)k*f[n-2*k+1]%mod-1)%mod;
29 printf("%d
",ans);
30 return 0;
31 }