{"problem":{"name":"Candles","description":{"content":"There are $N$ candles placed on a number line. The $i$\\-th candle from the left is placed on coordinate $x_i$. Here, $x_1 < x_2 < ... < x_N$ holds. Initially, no candles are burning. Snuke decides to ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc101_a"},"statements":[{"statement_type":"Markdown","content":"There are $N$ candles placed on a number line. The $i$\\-th candle from the left is placed on coordinate $x_i$. Here, $x_1 < x_2 < ... < x_N$ holds.\nInitially, no candles are burning. Snuke decides to light $K$ of the $N$ candles.\nNow, he is at coordinate $0$. He can move left and right along the line with speed $1$. He can also light a candle when he is at the same position as the candle, in negligible time.\nFind the minimum time required to light $K$ candles.\n\n## Constraints\n\n*   $1 \\leq N \\leq 10^5$\n*   $1 \\leq K \\leq N$\n*   $x_i$ is an integer.\n*   $|x_i| \\leq 10^8$\n*   $x_1 < x_2 < ... < x_N$\n\n## Input\n\nInput is given from Standard Input in the following format:\n\n$N$ $K$\n$x_1$ $x_2$ $...$ $x_N$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc101_a","tags":[],"sample_group":[["5 3\n-30 -10 10 20 50","40\n\nHe should move and light candles as follows:\n\n*   Move from coordinate $0$ to $-10$.\n*   Light the second candle from the left.\n*   Move from coordinate $-10$ to $10$.\n*   Light the third candle from the left.\n*   Move from coordinate $10$ to $20$.\n*   Light the fourth candle from the left."],["3 2\n10 20 30","20"],["1 1\n0","0\n\n*   There may be a candle placed at coordinate $0$."],["8 5\n-9 -7 -4 -3 1 2 3 4","10"]],"created_at":"2026-03-03 11:01:13"}}