Buggy python submission (verdict: Runtime Error):
; タイプ別設定 Ver1
; Monokai for Sakura Editor (C/C++)
; cpp_monokai.ini
;
;  Created on: 2015/06/13
;      Author: KeitetsuWorks

[Types]
C[BRC]=1,1,f2f8f8,a6e22e,0
C[CAR]=1,0,a5a5a5,222827,0
C[CBK]=0,0,f2f8f8,222827,0
C[CMT]=1,0,5e7175,222827,0
C[CTL]=1,0,a5a5a5,222827,0
C[CVL]=0,0,a5a5a5,222827,0
C[DFA]=1,0,222827,ffd0a2,0
C[DFC]=1,0,222827,c0fdbd,0
C[DFD]=1,0,222827,f2f8f8,0
C[EBK]=0,0,222827,222827,0
C[EOF]=1,0,a5a5a5,222827,0
C[EOL]=1,0,a5a5a5,222827,0
C[FN2]=1,0,222827,ffffa0,0
C[FN3]=1,0,222827,99ff99,0
C[FN4]=1,0,222827,9999ff,0
C[FN5]=1,0,222827,ff66ff,0
C[FND]=1,0,222827,00ffff,0
C[HDC]=0,0,74dbe6,222827,0
C[IME]=1,0,a5a5a5,222827,0
C[KW1]=1,0,efd966,222827,0
C[KW2]=1,0,7226f9,222827,0
C[KW3]=1,0,2ee2a6,222827,0
C[KW4]=1,0,1f97ff,222827,0
C[KW5]=1,0,ff81ae,222827,0
C[KW6]=1,0,ffffff,222827,0
C[KW7]=1,0,ffffff,222827,0
C[KW8]=1,0,ffffff,222827,0
C[KW9]=1,0,ffffff,222827,0
C[KWA]=1,0,ffffff,222827,0
C[LNO]=1,0,5e7175,222827,0
C[MOD]=1,1,5e7175,222827,0
C[MRK]=1,0,222827,c08000,0
C[NOT]=0,0,ffc0c0,f0fbff,0
C[NUM]=1,0,ff81ae,222827,0
C[PGV]=1,0,f0fbff,ffe6be,0
C[RAP]=1,0,463a96,222827,0
C[RK1]=0,0,ff0000,222827,0
C[RK2]=0,0,ff0000,222827,0
C[RK3]=0,0,ff0000,222827,0
C[RK4]=0,0,ff0000,222827,0
C[RK5]=0,0,ff0000,222827,0
C[RK6]=0,0,ff0000,222827,0
C[RK7]=0,0,ff0000,222827,0
C[RK8]=0,0,ff0000,222827,0
C[RK9]=0,0,ff0000,222827,0
C[RKA]=0,0,ff0000,222827,0
C[RUL]=1,0,5e7175,222827,0
C[SEL]=1,0,3e4849,3e4849,0
C[SPC]=0,0,c0c0c0,222827,0
C[SQT]=1,0,74dbe6,222827,0
C[TAB]=1,0,a5a5a5,222827,0
C[TXT]=1,0,f2f8f8,222827,0
C[UND]=1,0,a5a5a5,222827,0
C[URL]=1,0,7226f9,222827,1
C[VER]=0,0,463a96,222827,0
C[WQT]=1,0,74dbe6,222827,0
C[ZEN]=1,0,a5a5a5,222827,0
FileTree(0).bIgnoreHidden=1
FileTree(0).bIgnoreReadOny=0
FileTree(0).bIgnoreSystem=0
FileTree(0).eItemType=0
FileTree(0).nDepth=0
FileTree(0).szTargetFile=*.*
FileTree(0).szTargetPath=.
bAutoIndent=1
bAutoIndent_ZENSPACE=1
bChkEnterAtEnd=1
bDefaultBom=0
bFileTreeProject=1
bHokanLoHiCase=0
bInsSpace=1
bKinsokuHead=0
bKinsokuHide=0
bKinsokuKuto=0
bKinsokuRet=0
bKinsokuTail=0
bOutlineDockDisp=0
bOutlineSortDesc=0
bPriorCesu8=0
bRTrimPrevLine=0
bStringEndLine=0
bStringLineOnly=1
bTabArrow=0
bTypeHtmlHelpIsSingle=1
bUseDocumentIcon=0
bUseHokanByFile=1
bUseHokanByKeyword=0
bUseKeyHelpAllSearch=0
bUseKeyHelpKeyDisp=0
bUseKeyHelpPrefix=0
bUseKeyWordHelp=0
bUseRegexKeyword=0
bUseTypeFont=0
bgImgPath=
bgImgPos=0
bgImgPosOffsetX=0
bgImgPosOffsetY=0
bgImgRepeartX=1
bgImgRepeartY=1
bgImgScrollX=1
bgImgScrollY=1
cLineTermChar=:
eDefaultCodetype=0
eDefaultEoltype=1
eOutlineDockSide=0
id=1450618
lf=0,0,0,0,0,0,0,0,0,0,0,0,0
lfFaceName=
nDefaultOutline=1
nDockOutline=0
nFileTreeItemCount=1
nHokanType=0
nImeState=256
nIndentLayout=0
nInts=2,10240,0,4,16,17,0,1,1,0,0
nKeywordSelect10=-1
nKeywordSelect3=18
nKeywordSelect4=-1
nKeywordSelect5=-1
nKeywordSelect6=-1
nKeywordSelect7=-1
nKeywordSelect8=-1
nKeywordSelect9=-1
nLineCommentColumn=-1
nLineCommentColumn2=-1
nLineCommentColumn3=-1
nLineNumWidth=2
nLineSpace=1
nNoteLineOffset=0
nOutlineSortCol=0
nOutlineSortType=0
nPointSize=0
nSmartIndent=1
nTextWrapMethod=1
nVertLineIdx1=0
szBlockCommentFrom=/*
szBlockCommentFrom2=#if 0
szBlockCommentTo=*/
szBlockCommentTo2=#endif
szExtHelp=
szExtHtmlHelp=
szFileTreeProjectIni=
szHokanFile=
szIndentChars=
szKinsokuHead=
szKinsokuKuto=、。，．､｡,.
szKinsokuTail=
szLineComment=//
szLineComment2=
szLineComment3=
szOutlineRuleFilename=
szTabViewString=^       
szTypeExts=c,cpp,cxx,cc,cp,c++,h,hpp,hxx,hh,hp,h++,rc,hm
szTypeName=C/C++
xyOutlineDock=0,0,0,0

[TypeEx]
szKeywordCase[1]=1
szKeywordCase[2]=1
szKeywordCase[3]=1
szKeywordFile[1]=cpp_kw1_datatypes.kwd
szKeywordFile[2]=cpp_kw2_keywords.kwd
szKeywordFile[3]=cpp_kw3_functions.kwd
szKeyword[1]=cpp_kw1_datatypes
szKeyword[2]=cpp_kw2_keywords
szKeyword[3]=cpp_kw3_functions

[Info]
szVersion=2.2.0.1
vStructureVersion=166



Fixed submission:
N,K = map(int,input().split())

mod = 10**9+7
ans = 0

for i in range(K,N+2):
    min = (0+i-1)*i//2
    max = (N+N-i+1)*i//2
    
    ans += (max-min+1)%mod
    
print(ans%mod)