import heapq def dijkstra(graph, v, dist, P): hq = [] heapq.heappush(hq, [0, v]) dist[v] = 0 while len(hq) > 0: min_d, cur = heapq.heappop(hq) if dist[cur] != min_d: continue for next_cur, next_d in graph[cur]: if dist[next_cur] > dist[cur] + (next_d + P - 1) // P - 1: dist[next_cur] = dist[cur] + (next_d + P - 1) // P - 1 heapq.heappush(hq, [dist[next_cur], next_cur]) N, K = map(int, input().split()) sx, sy, gx, gy = map(int, input().split()) graph = [[] for _ in range(N + 2)] X = [] Y = [] for i in range(N): x, y = map(int, input().split()) X.append(x) Y.append(y) for i in range(N): for j in range(N): if i != j: graph[i].append([j, abs(X[i] - X[j]) + abs(Y[i] - Y[j])]) for i in range(N): graph[N].append([i, abs(X[i] - sx) + abs(Y[i] - sy)]) graph[i].append([N, abs(X[i] - sx) + abs(Y[i] - sy)]) for i in range(N): graph[N + 1].append([i, abs(X[i] - gx) + abs(Y[i] - gy)]) graph[i].append([N + 1, abs(X[i] - gx) + abs(Y[i] - gy)]) graph[N].append([N + 1, abs(sx - gx) + abs(sy - gy)]) graph[N + 1].append([N, abs(sx - gx) + abs(sy - gy)]) INF = 10 ** 7 ng = 0 ok = 200002 while ok - ng > 1: center = (ok + ng) // 2 dist = [INF for _ in range(N + 2)] dijkstra(graph, N, dist, center) if dist[N + 1] <= K: ok = center else: ng = center #print(ok, ng) print(ok)