

def main():
    nk = list(map(int, input().split()))

    c = 0
    mii = sum(range(nk[1]))
    maa = sum(range(nk[0]-nk[1]+1, nk[0]+1))
    for i in range(nk[1], nk[0]+2):
        c += maa-mii+1
        #print(c, mii, maa)
        mii += i
        maa += nk[0]-i

    print(c)

if __name__ == '__main__':
    main()
