from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N,K = map(int,input().split()) sx,sy,gx,gy = map(int,input().split()) xy = [tuple(map(int,input().split())) for _ in range(N)] xy = [(sx,sy)] + xy + [(gx,gy)] e = [[] for _ in range(N+2)] for i in range(N+1): xi,yi = xy[i] for j in range(i+1,N+2): xj,yj = xy[j] d = abs(xi-xj)+abs(yi-yj) e[i].append((j,d)) e[j].append((i,d)) INF = (1<<30) def dijkstra(s,e,k): N = len(e) dist = [INF]*N dist[s]=0 h = [] heappush(h,(0,s)) while h: nw,v = heappop(h) if dist[v]!=nw: continue for iv,ic in e[v]: nc = (ic-1)//k + nw if nc < dist[iv]: dist[iv] = nc heappush(h,(nc,iv)) return dist def is_ok(k): return dijkstra(0,e,k)[N+1]<=K if is_ok(1): print(1) exit() x = 1 y = 10**7 while y-x>1: mid = (y+x)//2 if is_ok(mid): y = mid else: x = mid print(y)