output_description: Print the minimum time required to light K candles.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
      x_1 x_2 ... x_N
attempt: num = input().split(" ")
  zahyou = input().split(" ")
  
  num[1] = int(num[1])
  plus = []
  minus = []
  rousoku = []
  for i in range(int(num[0])):
      if int(zahyou[i]) < 0:
          minus.append(int(zahyou[i]))
      else:
          plus.append(int(zahyou[i]))
  
  # プラス方向で終了する場合
  
  if num[1] > len(plus):
      plus_tmp = minus[(len(plus) - num[1]) :] + plus
      minus_tmp = minus[: (len(minus) + len(plus_tmp) - num[1] - 1)]
  rousoku = plus_tmp[0 : num[1]]
  minus_tmp_2 = []
  for i in minus_tmp:
      minus_tmp_2.append(i)
  while True:
      if rousoku[-1] - rousoku[-2] >= (min(min(rousoku), 0) - minus_tmp_2[-1]) * 2:
          rousoku.pop(-1)
          rousoku.insert(0, minus_tmp_2.pop(-1))
      else:
          break
  rousoku_move_plus = []
  for i in rousoku:
      rousoku_move_plus.append(i - min(rousoku) * 2)
  
  # マイナス方向で終了する場合
  if num[1] > len(minus):
      minus_tmp = minus + plus[: (num[1] - len(minus))]
      plus_tmp = plus[(num[1] - len(minus)) :]
  rousoku = minus_tmp[(-(num[1] + 1)) :]
  plus_tmp_2 = []
  for i in plus_tmp:
      plus_tmp_2.append(i)
  while True:
      if rousoku[1] - rousoku[0] >= (plus_tmp_2[0] - max(max(rousoku), 0)) * 2:
          rousoku.pop(0)
          rousoku.append(plus_tmp_2.pop(0))
      else:
          break
  rousoku_move_minus = []
  for i in rousoku:
      rousoku_move_minus.append(max(rousoku) * 2 - i)
  
  print(min(max(rousoku_move_plus), max(rousoku_move_minus)))
  
problem_description: Statement
  
  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 light K of the N candles.
  
  Now, 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.
  
  Find the minimum time required to light K candles.
samples: [{"input": "5 3\n    -30 -10 10 20 50", "output": "40\n    \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.\n\n* * *"}, {"input": "3 2\n    10 20 30", "output": "20\n    \n\n* * *"}, {"input": "1 1\n    0", "output": "0\n    \n\n  * There may be a candle placed at coordinate 0.\n\n* * *"}, {"input": "8 5\n    -9 -7 -4 -3 1 2 3 4", "output": "10"}]