import math def main(): import sys input = sys.stdin.read().split() idx = 0 N = int(input[idx]) K = int(input[idx+1]) idx +=2 s_x, s_y, g_x, g_y = map(int, input[idx:idx+4]) idx +=4 nodes = [] for _ in range(N): x, y = int(input[idx]), int(input[idx+1]) nodes.append((x, y)) idx +=2 D = abs(s_x - g_x) + abs(s_y - g_y) low = 0 high = D answer = D while low <= high: if low == high: mid = low else: mid = (low + high) // 2 if mid == 0: possible = False else: required_direct = max((D + mid -1) // mid -1, 0) min_required = required_direct for (x, y) in nodes: d1 = abs(s_x - x) + abs(s_y - y) d2 = abs(g_x - x) + abs(g_y - y) part1 = (d1 + mid -1) // mid -1 if mid !=0 else 0 part2 = (d2 + mid -1) // mid -1 if mid !=0 else 0 total = part1 + part2 if total < min_required: min_required = total if min_required <= K: possible = True else: possible = False if possible: answer = mid high = mid -1 else: low = mid +1 print(answer) if __name__ == '__main__': main()