#include <bits/stdc++.h>
// #include <atcoder/modint>
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define INF 200000000
#define ll int
#define ull unsigned long long
#define ld long double
#define pll pair<ll, ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const double PI = 3.141592653589793238462643383279;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll N, K;
  cin >> N >> K;
  vector<pll> points(N + 2);
  for (ll i = 0; i < N + 2; ++i) {
    cin >> points.at(i).first >> points.at(i).second;
  }
  ll l = 0, r = 200010;
  //log(10 ^ 5) ≒ 20
  while (l + 1 < r) {
    ll m = (l + r) / 2;
    vector<ll> dp(N + 2, INF);
    dp.at(0) = 0;
    priority_queue<pll, vector<pll>, greater<pll>> q;
    q.push({0, 0});
    while (!q.empty()) {
      ll now = q.top().second, d = q.top().first;
      q.pop();
      if (d > dp.at(now)) {
        continue;
      }
      for (ll i = 0; i < N + 2; ++i) {
        ll nd = d + max(0, abs(points.at(now).first - points.at(i).first) + abs(points.at(now).second - points.at(i).second) - 1) / m;
        if (dp.at(i) > nd) {
          dp.at(i) = nd;
          q.push({nd, i});
        }
      }
      if (dp.at(1) <= K) {
        break;
      }
    }
    // cout << "dp" << m << "\n";
    // for (ll i = 0; i < N + 2; ++i) {
    //   cout << dp.at(i) << " ";
    // }
    // cout << "\n";
    if (dp.at(1) <= K) {
      r = m;
    }
    else {
      l = m;
    }
  }
  cout << r << "\n";
}