{"raw_statement":[{"iden":"problem statement","content":"Takahashi has come to an amusement park.  \nThe park has $N$ attractions. The _fun_ of the $i$\\-th attraction is initially $a_i$.\nWhen Takahashi rides the $i$\\-th attraction, the following sequence of events happens.\n\n*   Takahashi's _satisfaction_ increases by the current fun of the $i$\\-th attraction.\n*   Then, the fun of the $i$\\-th attraction decreases by $1$.\n\nTakahashi's satisfaction is initially $0$. He can ride the attractions at most $K$ times in total in any order.  \nWhat is the maximum possible value of satisfaction Takahashi can end up with?\nOther than riding the attractions, nothing affects Takahashi's satisfaction."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 10^5$\n*   $1 \\leq K \\leq 2 \\times 10^9$\n*   $1 \\leq A_i \\leq 2 \\times 10^9$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $K$\n$A_1$ $A_2$ $\\dots$ $A_N$"},{"iden":"sample input 1","content":"3 5\n100 50 102"},{"iden":"sample output 1","content":"502\n\nTakahashi should ride the first attraction twice and the third attraction three times.  \nHe will end up with the satisfaction of $(100+99)+(102+101+100)=502$.  \nThere is no way to get the satisfaction of $503$ or more, so the answer is $502$."},{"iden":"sample input 2","content":"2 2021\n2 3"},{"iden":"sample output 2","content":"9\n\nTakahashi may choose to ride the attractions fewer than $K$ times in total."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}