#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

template<typename T> using pq = priority_queue<T, vector<T>, greater<T>>;
using ll = long long; 

ll N, K;
vector<ll> x, y;

bool solve(ll P){
 
    ll from, alt, d;
    pq<pair<ll, ll>> que;
    vector<ll> dist(N+2, 1e18);
    vector<bool> visit(N+2);
 
    dist[0] = 0;
    que.push({0, 0});
 
    while(!que.empty()){
        tie(d, from) = que.top();
        que.pop();
        if (visit[from]) continue;
        visit[from] = 1;
        for (int to=0; to<N+2; to++){
            alt = d + max(((abs(x[to]-x[from])+abs(y[to]-y[from]))+P-1)/P-1, 0LL);
            if (alt < dist[to]){
                dist[to] = alt;
                que.push({dist[to], to});
            }
        }
    }

    return dist[N+1] <= K;
}

int main(){

    ll a, b;
    cin >> N >> K;
    cin >> a >> b;
    x.resize(N+2); y.resize(N+2);
    x[0] = a; y[0] = b;
    cin >> a >> b;
    x[N+1] = a; y[N+1] = b;
    for (int i=1; i<=N; i++){
        cin >> a >> b;
        x[i] = a; y[i] = b;
    }
    ll l=0, r=1e6, c;
    while(r-l>1){
        c = (l+r)/2;
        if (solve(c)) r=c;
        else l=c;
    }

    cout << r << endl;
}