program ABC163D
    implicit none
    integer(8)::N,K,ans,m,i
    read*,N,K
    m=10**9+7
    ans=0
    do i=K,N+1
        ans=ans+-1*i**2+(N+1)*i+1
        ans=mod(ans,m)
    end do

    print'(i0)',ans
end program ABC163D