use proconio::input;
const MODN:i128 = 1000000007;

fn main() {
    input!{
        n:i128,
        k:i128,
    }
    let mut ans = 0;
    for sel in k..=n+1{
        ans = ((ans as i128) % MODN + (((2*n-(sel-1)) * sel / 2 - (sel-1) * sel / 2 + 1_i128)) % MODN) as i32;
    }
    println!("{}",ans);
}