program main
      implicit none
      integer(8) :: n, k, i, j
      integer(16) :: sta, fin
      integer(16) :: cnt

      read *, n, k

      cnt = 0
      do j = k, n+1
        sta = j*(j-1)/2
        fin = 0
        do i = 1, j
          fin = fin + (n+1-i)
        end do
        cnt = cnt + fin-sta+1
      end do

      print *, mod(cnt,1000000007)

end program main
