import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] x = new int[n + 2]; int[] y = new int[n + 2]; x[0] = sc.nextInt(); y[0] = sc.nextInt(); x[n + 1] = sc.nextInt(); y[n + 1] = sc.nextInt(); for (int i = 1; i <= n; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); } sc.close(); int[] d = new int[n + 2]; boolean[] fix = new boolean[n + 2]; int ok = 200000; int ng = 0; while (Math.abs(ok - ng) > 1) { int mid = (ok + ng) / 2; Arrays.fill(d, 1000000007); d[0] = 0; Arrays.fill(fix, false); fix[0] = true; while (true) { int min = 1000000007; int cur = 0; for (int i = 0; i < d.length; i++) { if (!fix[i] && d[i] < min) { min = d[i]; cur = i; } } if (cur == n + 1) { break; } fix[cur] = true; for (int next = 1; next <= n + 1; next++) { int v1 = Math.abs(x[cur] - x[next]) + Math.abs(y[cur] - y[next]); int alt = d[cur] + (v1 - 1) / mid; if (alt < d[next]) { d[next] = alt; } } } if (d[n + 1] <= k) { ok = mid; } else { ng = mid; } } System.out.println(ok); } }