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: class Solver(object):
      def __init__(self):
          self.n, self.k = list(map(int, input().split(" ")))
          self.x_s = sorted(list(map(int, input().split(" "))))
  
      def solve(self):
          # candles = self.filter()
          candles = self.x_s
          candidates = []
          for i in range(len(candles) - self.k + 1):
              candidates.append((i, i + self.k))
              # print(self.x_s[i:i+self.k])
          best_candidate = candidates[0]
          best_distance = self.distance(best_candidate)
          for c in candidates[1:]:
              d = self.distance(c)
              if d < best_distance:
                  best_candidate = c
                  best_distance = d
          # print(best_candidate)
          print(best_distance)
  
      def distance(self, candidate):
          left = self.x_s[candidate[0]]
          right = self.x_s[candidate[1] - 1]
          # X X X 0
          if right <= 0:
              return left
          # 0 X X X
          elif left >= 0:
              return right
          # X 0 X X
          elif abs(left) < abs(right):
              return abs(left) + abs(left) + abs(right)
          # X X 0 X
          else:
              return abs(right) + abs(right) + abs(left)
  
      def filter(self):
          # Only want -k .. k elements
          right = None
          counter = 0
          for i, v in enumerate(self.x_s):
              if v >= 0:
                  counter += 1
                  if counter == self.k:
                      right = i + 1
                      break
          if right is None:
              right = len(self.x_s)
  
          left = None
          counter = 0
          for i, v in reversed(list(enumerate(self.x_s))):
              if v <= 0:
                  counter += 1
                  if counter == self.k:
                      left = i
                      break
          if left is None:
              left = 0
          return self.x_s[left:right]
  
  
  if __name__ == "__main__":
      s = Solver()
      s.solve()
  
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"}]