#include <bits/stdc++.h>
using namespace std;
int n, k;
long long a[200005];
struct apple {
  long long val1, val2;
} tmp[200005];
bool cmp(apple a, apple b) {
  if (a.val1 == b.val1)
    return a.val2 < b.val2;
  else
    return a.val1 < b.val1;
}
multiset<long long> s;
bool judge(long long x) {
  for (long long i = 1; i <= n; i++) {
    tmp[i].val1 = x * i * 1LL - a[i];
    tmp[i].val2 = x * i * 1LL + a[i];
  }
  sort(tmp + 1, tmp + n + 1, cmp);
  s.clear();
  multiset<long long>::iterator it;
  for (int i = 1; i <= n; i++) {
    it = s.upper_bound(tmp[i].val2);
    if (it == s.end())
      s.insert(tmp[i].val2);
    else {
      s.erase(it);
      s.insert(tmp[i].val2);
    }
  }
  if (s.size() >= n - k) return true;
  return false;
}
int main() {
  long long l = 0, r = 0;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (i > 1) r = max(r, abs(a[i] - a[i - 1]));
  }
  long long mid, ans;
  while (l <= r) {
    mid = (l + r) / 2;
    if (judge(mid))
      ans = mid, r = mid - 1;
    else
      l = mid + 1;
  }
  printf("%lld", ans);
  return 0;
}
