program sample
implicit none
integer(8) N,K,A(200000),i,count,Sm,Ss
read(*,*)N,K
do i=0,N
 A(i)=i
end do
count=0
do i=K,N+1-K
   Sm=0
   Ss=0
 do m=0,K
    Sm=N-m+Sm
    Ss=Ss+m
 end do
count=count+Sm-Ss+1
end do
write(*,'(i0)') mod(count,10**9+7)

stop
end program sample