program sample
implicit none
integer(8) N,K,i,count,Sm,Ss,m
read(*,*)N,K

count=0
do i=K,N+1
   Sm=0
   Ss=0
 do m=1,i
    Sm=N-m+Sm+1
    Ss=Ss+m-1
 end do
count=count+Sm-Ss+1
end do
write(*,'(i0)') mod(count,10**9+7)

stop
end program sample