from heapq import heappop,heappush n,k = map(int,input().split()) sx,sy,gx,gy = map(int,input().split()) xy = [(sx,sy)]+[tuple(map(int,input().split())) for _ in range(n)]+[(gx,gy)] dist = [[0]*(n+2) for _ in range(n+2)] for i,(ix,iy) in enumerate(xy): for j,(jx,jy) in enumerate(xy): dist[i][j] = abs(ix-jx)+abs(iy-jy) ng = 0; ok = dist[0][n+1] while ok-ng>1: mid = (ng+ok)//2 d = [10**9]*(n+2); hq = [(0,0)] while hq: v,p = heappop(hq) if d[p]!=10**9: continue d[p] = v for i in range(n+2): if d[i]==10**9: heappush(hq,(d[p]+(dist[p][i]-1)//mid,i)) if d[n+1]<=k: ok = mid else: ng = mid print(ok)