import collections import heapq N,K = map(int, input().split()) sx,sy,gx,gy = map(int, input().split()) XY = [list(map(int, input().split())) for _ in range(N)] XY.append([sx,sy]) XY.append([gx,gy]) def is_ok(P): G = Dijkstra() for i in range(N+2): for j in range(i+1,N+2): temp = abs(XY[i][0]-XY[j][0])+abs(XY[i][1]-XY[j][1]) G.add(i,j,-(-temp//P)-1) D = G.search(N) return D[N+1]<=K def meguru_bisect(ng, ok): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok class Dijkstra: def __init__(self): self.e = collections.defaultdict(list) def add(self, u, v, d): self.e[u].append([v, d]) self.e[v].append([u, d]) def delete(self, u, v): self.e[u] = [_ for _ in self.e[u] if _[0] != v] self.e[v] = [_ for _ in self.e[v] if _[0] != u] def search(self, s): d = collections.defaultdict(lambda: 10**6+10) d[s] = 0 q = [] heapq.heappush(q, (0, s)) v = collections.defaultdict(bool) while len(q): k, u = heapq.heappop(q) if v[u]: continue v[u] = True for uv, ud in self.e[u]: if v[uv]: continue vd = k + ud if d[uv] > vd: d[uv] = vd heapq.heappush(q, (vd, uv)) return d print(meguru_bisect(0,2*10**5+1000))