#lang racket

(define (sum items)
  (if (null? items)
      0
      (+ (car items) (sum (cdr items)))))
                                       
(define (solve N K)
  (define (iter mini maxi l r)
    (if (or (> l N) (< r 0))
        1
        (+ 1 (- maxi mini) (iter (+ mini l 1)
                               (+ maxi r 1)
                               (+ l 1)
                               (- r 1)))))
  (iter (sum (range K))
        (sum (range (- N K -1) (+ N 1)))
        K
        (- N K)))

(let* ([N (read)]
       [K (read)])
       (display (modulo (solve N K) (+ (expt 10 9) 7))))