open System
let M = (int64 1e9) + 7L
let (N, K) = let t = Console.ReadLine().Split() |> Array.map int in t.[0], t.[1]

let cusum =
    let nums = [0..N]
    let rec f = 
        function 
        | [], _ -> []
        | xs, [] -> xs
        | x::_ as xs, y::ys -> f ((x + y)::xs, ys) 
    f ([0L], List.map int64 nums)
    |> List.rev 
    |> Array.ofList

let f n =
    let min = cusum.[n]
    let max = cusum.[N + 1] - cusum.[N + 1 - n]
    max - min + 1L
    
List.map f [K .. N + 1]
|> List.reduce (fun acc x -> (acc + x) % M) 
|> Console.WriteLine