#include <bits/stdc++.h>
using namespace std;
using ll = long long;

struct FenwickMax {
    int n;
    vector<int> bit;

    FenwickMax(int n = 0) { init(n); }

    void init(int n_) {
        n = n_;
        bit.assign(n + 1, 0);
    }

    void update(int idx, int val) {
        for (; idx <= n; idx += idx & -idx)
            bit[idx] = max(bit[idx], val);
    }

    int query(int idx) {
        int res = 0;
        for (; idx > 0; idx -= idx & -idx)
            res = max(res, bit[idx]);
        return res;
    }
};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];

    auto check = [&](ll x) -> bool {
        vector<ll> L(n), R(n);
        for (int i = 0; i < n; i++) {
            L[i] = a[i] - 1LL * i * x;
            R[i] = a[i] + 1LL * i * x;
        }

        vector<ll> comp = R;
        sort(comp.begin(), comp.end());
        comp.erase(unique(comp.begin(), comp.end()), comp.end());

        auto getPos = [&](ll v) {
            return (int)(lower_bound(comp.begin(), comp.end(), v) - comp.begin()) + 1;
        };

        vector<int> ord(n);
        iota(ord.begin(), ord.end(), 0);
        sort(ord.begin(), ord.end(), [&](int i, int j) {
            if (L[i] != L[j]) return L[i] > L[j];
            if (R[i] != R[j]) return R[i] < R[j];
            return i < j;
        });

        FenwickMax fw((int)comp.size());
        int bestAll = 0;

        for (int id : ord) {
            int pos = getPos(R[id]);
            int best = fw.query(pos);
            int cur = best + 1;
            fw.update(pos, cur);
            bestAll = max(bestAll, cur);
        }

        return n - bestAll <= k;
    };

    ll lo = -1, hi = 2000000000LL;
    while (hi - lo > 1) {
        ll mid = (lo + hi) / 2;
        if (check(mid)) hi = mid;
        else lo = mid;
    }

    cout << hi << '\n';
    return 0;
}
