output_description: Print the minimum possible value taken by N after Aoki does the operation zero
  or more times.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N K
attempt: NK = list(map(int, input().split()))
  
  N = NK[0]
  K = NK[1]
  
  old = max(NK)
  new = 0
  
  while old > new:
      old = new
      for i in range(10):
          if i == 0:
              temp = []
              temp.append(abs(N - K))
              temp.append(abs(K - N))
          else:
              temp1 = []
              temp1.append(abs(temp - K))
              temp1.append(abs(temp - N))
              temp = temp1
          temp = min(temp)
      new = temp
  
  
  print(temp)
  
problem_description: Statement
  
  Given any integer x, Aoki can do the operation below.
  
  Operation: Replace x with the absolute difference of x and K.
  
  You are given the initial value of an integer N. Find the minimum possible
  value taken by N after Aoki does the operation zero or more times.
samples: [{"input": "7 4", "output": "1\n    \n\nInitially, N=7.\n\nAfter one operation, N becomes |7-4| = 3.\n\nAfter two operations, N becomes |3-4| = 1, which is the minimum value taken by\nN.\n\n* * *"}, {"input": "2 6", "output": "2\n    \n\nN=2 after zero operations is the minimum.\n\n* * *"}, {"input": "1000000000000000000 1", "output": "0"}]