import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

data class ModInt(var value: Long) {
    init {
        assert(value in 0 until MOD)
    }

    override fun toString(): String = value.toString()

    operator fun plusAssign(b: Long) {
        this.value += b
        this.value %= MOD
    }

    operator fun plusAssign(b: ModInt) {
        this.value += b.value
        this.value %= MOD
    }

    companion object {
        const val MOD = 1000000007L
    }
}


object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toLong()
        val K = sc.next().toLong()
        val ans = ModInt(0L)
        for (k in K..(N + 1)) {
            // 0 + 1 + 2 + 3 + ...
            val a = (k - 1) * k / 2
            val b = k * N - a * 2 + 1
            ans += b
        }
        pw.println(ans)
    }
}
