{"raw_statement":[{"iden":"problem statement","content":"Takahashi has an integer $x$. Initially, $x = 0$.\nThere are $N$ operations. The $i$\\-th operation $(1 \\leq i \\leq N)$ is represented by two integers $t_i$ and $y_i$ as follows:\n\n*   If $t_i = 1$, replace $x$ with $y_i$.\n*   If $t_i = 2$, replace $x$ with $x + y_i$.\n\nTakahashi may skip any number between $0$ and $K$ (inclusive) of the operations. When he performs the remaining operations once each without changing the order, find the maximum possible final value of $x$."},{"iden":"constraints","content":"*   $1 \\leq N \\leq 2 \\times 10^5$\n*   $0 \\leq K \\leq N$\n*   $t_i \\in {1,2} \\, (1 \\leq i \\leq N)$\n*   $|y_i| \\leq 10^9 \\, (1 \\leq i \\leq N)$\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$t_1$ $y_1$\n$\\vdots$\n$t_N$ $y_N$"},{"iden":"sample input 1","content":"5 1\n2 4\n2 -3\n1 2\n2 1\n2 -3"},{"iden":"sample output 1","content":"3\n\nIf he skips the $5$\\-th operation, $x$ changes as $0 \\rightarrow 4 \\rightarrow 1 \\rightarrow 2 \\rightarrow 3$, so $x$ results in $3$. This is the maximum."},{"iden":"sample input 2","content":"1 0\n2 -1000000000"},{"iden":"sample output 2","content":"\\-1000000000"},{"iden":"sample input 3","content":"10 3\n2 3\n2 -1\n1 4\n2 -1\n2 5\n2 -9\n2 2\n1 -6\n2 5\n2 -3"},{"iden":"sample output 3","content":"15"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}