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: n, k = list(map(int, input().split()))
  # print(n, k)
  
  
  min_result = n
  flag = 0
  dic = {}
  
  z = n // k
  zz = n // z
  result = zz
  
  while flag == 0:
      result = abs(result - k)
      print("result", result)
      print("min_result", min_result)
      if result <= min_result:
          min_result = result
          dic[result] = dic.get(result, 0) + 1
  
          if dic[result] > 1:
              flag = 1
  print(min_result)
  
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"}]