#include <bits/stdc++.h> using namespace std; using ll =long long; #define all(v) v.begin(),v.end() #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) ll INF=1e18; int main() { ios::sync_with_stdio(false); cin.tie(0); ll N,K;cin>>N>>K; vector<ll> x(N+2),y(N+2); cin>>x[0]>>y[0]; cin>>x[N+1]>>y[N+1]; for(ll i=1;i<=N;i++) cin>>x[i]>>y[i]; ll s=1; ll g=3e5; while(s<g) { ll k=(s+g)/2; priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>> S; S.push(make_pair(0,0)); vector<ll> d(N+2,INF); d[0]=0; while(!S.empty()) { auto p=S.top(); S.pop(); if(d[p.second]<p.first) continue; for(ll i=0;i<N+2;i++) { if(i==p.second) continue; ll cost=abs(x[i]-x[p.second])+abs(y[i]-y[p.second]); if(cost%k==0) cost=cost/k-1; else cost/=k; if(p.first+cost<d[i]) { d[i]=p.first+cost; S.push(make_pair(d[i],i)); } } } if(d[N+1]<=K) g=k; else s=k+1; } cout<<s<<endl; }