R=range def rec_str(a): if not isinstance(a,list):return str(a) return "".join(["[",", ".join(rec_str(x)for x in a),"]"]) class BIT: def __init__(self,x): if isinstance(x,int): self.N=x self.F=[0]*(x+1) else: self.N=len(x) self.F=[0]*(self.N+1) for j in R(1,self.N+1): i=j-1 self.F[j]=x[i] k=j-(j&-j) while i>k: self.F[j]+=self.F[i] i-=i&-i def Add(self,i,u): i+=1 while i<=self.N: self.F[i]+=u i+=i&-i def InitialSegmentSum(self,r): assert(r>-2) a=0 i=min(r+1,self.N) while i: a+=self.F[i] i-=i&-i return a class IntervalAddBIT: def __init__(self,N): self.N=N self.F=BIT(N+1) self.G=BIT(N+1) def IntervalAdd(self,l,r,u): self.F.Add(l,-(l-1)*u) self.F.Add(r+1,r*u) self.G.Add(l,u) self.G.Add(r+1,-u) def Add(self,i,u): self.IntervalAdd(i,i,u) def Set(self,i,u): self.Add(i,u-self.Get(i)) def InitialSegmentSum(self,r): return self.F.InitialSegmentSum(r)+r*self.G.InitialSegmentSum(r) def IntervalSum(self,l,r): return self.InitialSegmentSum(r)-self.InitialSegmentSum(l-1) def Get(self,i): return self.IntervalSum(i,i) def list(self): return[self.Get(i)for i in R(self.N)] def __str__(self): return rec_str(self.list()) N,L=map(int,input().split()) P=10**9+7 bit=IntervalAddBIT(N+1) bit.Add(0,1); for i in R(N):bit.IntervalAdd(i+1,i+L,bit.Get(i)%P) print(bit.Get(N)%P)