program main
    implicit none
    integer n,k,i,j,p,q,x
    read(*,*) n,k
    p=0
    q=0
    do j=1,k
        p=j*(j+1)/2
        q=(n+1)*j-p
        x=x+q-p+1
    end do
    write(*,*) x
end program main
