#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[2020];
int f[2020];
bool ok(long long c) {
  for (int i = 1; i <= n; i++) f[i] = i - 1;
  int change = 1e9;
  for (int i = 1; i <= n; i++) {
    long long l = a[i] - c, r = a[i] + c;
    for (int j = i + 1; j <= n; j++) {
      if (a[j] >= l && a[j] <= r) f[j] = min(f[j], f[i] + (j - i - 1));
      l -= c;
      r += c;
    }
    change = min(change, f[i] + n - i);
  }
  return change <= k;
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  long long l = 0, r = 2000000000;
  while (l < r) {
    long long mid = (l + r) / 2;
    if (!ok(mid))
      l = mid + 1;
    else
      r = mid;
  }
  printf("%I64d", l);
  return 0;
}
