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: n, k = map(int, input().split())
  l = [int(i) for i in input().split()]
  right = [i for i in l if i > 0]
  left = [i for i in l if i <= 0]
  if not left:
      sm = 0
      sm += l[0]
      for i in range(1, k):
          sm += l[i] - l[i - 1]
      print(sm)
      exit()
  if not right:
      sm = 0
      l = [abs(i) for i in l]
      sm = l[0]
      for i in range(1, k):
          sm += l[i] - l[i - 1]
      print(sm)
      exit()
  le = len(left)
  ri = len(right)
  rl = [0] * le
  rr = [0] * ri
  left = [abs(i) for i in left]
  left = left[::-1]
  rl[0] = left[0]
  for i in range(1, le):
      rl[i] = rl[i - 1] + (left[i] - left[i - 1])
  rr[0] = right[0]
  mini = 10**20
  for i in range(1, ri):
      rr[i] = rr[i - 1] + (right[i] - right[i - 1])
  if len(left) >= k:
      mini = min(mini, rl[k - 1])
  if len(right) >= k:
      mini = min(mini, rr[k - 1])
  if k == n:
      print(sum(rl) + sum(rr))
      exit()
  for a in range(1, len(left)):
      b = k - a
      if b > len(rr):
          continue
      mini = min(mini, 2 * rl[a - 1] + rr[b - 1], rl[a - 1] + 2 * rr[b - 1])
  print(mini)
  
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"}]