output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N i
attempt: import math
  
  N, K = map(int, input().split())
  a = list(map(int, input().split()))
  l = 0
  r = K - 1
  Min = float("inf")
  for i in range(N - K + 1):
      if a[l] * a[r] <= 0:  # 原点を跨ぐとき
          Min = min(Min, abs(a[l]) + abs(a[l] - a[r]), abs(a[r]) + abs(a[r] - a[l]))
      elif l == 0:  # 左端の時
          if a[r] * a[r + 1] < 0 or a[0] > 0:
              Min = min(Min, abs(a[l]) + abs(a[l] - a[r]), abs(a[r]) + abs(a[r] - a[l]))
      elif r == N - 1:  # 右端の時
          if a[l - 1] * a[l] < 0 or a[l] > 0:
              Min = min(Min, abs(a[l]) + abs(a[l] - a[r]), abs(a[r]) + abs(a[r] - a[l]))
      else:
          if a[r] * a[r + 1] < 0 or a[l - 1] * a[l] < 0:
              Min = min(Min, abs(a[l]) + abs(a[l] - a[r]), abs(a[r]) + abs(a[r] - a[l]))
      l = l + 1
      r = r + 1
  print(Min)
  
problem_description: Statement
  
  There is an N-car train.
  
  You are given an integer i. Find the value of j such that the following
  statement is true: "the i-th car from the front of the train is the j-th car
  from the back."
samples: [{"input": "4 2", "output": "3\n    \n\nThe second car from the front of a 4-car train is the third car from the back.\n\n* * *"}, {"input": "1 1", "output": "1\n    \n\n* * *"}, {"input": "15 11", "output": "5"}]