/**
  * In the name of Lord Hanuman
**/

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

#define int long long
#define in(a)                       int a; cin>>a;
#define in2(a,b)                    int a,b; cin>>a>>b;
#define in3(a,b,c)                  int a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                int a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define deb(x)                      cout<<#x<<" "<<x<<endl;
#define pb                          push_back
#define pob                         pop_back
#define fill(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"
#define ce(x)                       cout<<x<<"\n";
#define nl							cout<<endl;
#define jaldi						ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
const int dxx[] = {1,1,0,-1,-1,-1,0,1};
const int dyy[] = {0,1,1,1,0,-1,-1,-1};

#define error(args...){string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it,args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int gcd(int a,int b){if(!b)return a;return gcd(b,a%b);}
int lcm(int a, int b){return (a*b)/gcd(a, b);}
int modexpo(int x,int n,int M){
	if(n==0)return 1;
	else if(n%2 == 0)return modexpo((x*x)%M,n/2,M);
	else return(x*modexpo((x*x)%M,(n-1)/2,M))%M;
}
int bexpo(int x,int n){
	if(n==0)return 1;
	else if(n%2==0)return bexpo(x*x,n/2);
	else return x*bexpo(x*x,(n-1)/2);
}

bool isPrime(int n){if(n<=1)
    return false; if(n<=3) return true; if(n%2==0 || n%3==0)return false;
    for(int i=5;i*i<=n;i=i+6)if(n%i==0 || n%(i+2)==0)return false;return true;
}

const int mod=1e9+7;
const int N=4e5+5;
const int INF=1e18;

void solve(){
	// Always imagine numbers on the number line bro
	in3(x,y,n);

	if(n%x>=y){
		cout<<n-(n%x)+y<<endl;
		return;
	}
	cout<<n-(n%x)-x+y<<endl;
}

int32_t main(){
	// jaldi
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
}

/*

*/


/**
  * In the name of Lord Hanuman
**/

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

#define int long long
#define in(a)                       int a; cin>>a;
#define in2(a,b)                    int a,b; cin>>a>>b;
#define in3(a,b,c)                  int a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                int a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define deb(x)                      cout<<#x<<" "<<x<<endl;
#define pb                          push_back
#define pob                         pop_back
#define fill(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"
#define ce(x)                       cout<<x<<"\n";
#define nl							cout<<endl;
#define jaldi						ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
const int dxx[] = {1,1,0,-1,-1,-1,0,1};
const int dyy[] = {0,1,1,1,0,-1,-1,-1};

#define error(args...){string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it,args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int gcd(int a,int b){if(!b)return a;return gcd(b,a%b);}
int lcm(int a, int b){return (a*b)/gcd(a, b);}
int modexpo(int x,int n,int M){
	if(n==0)return 1;
	else if(n%2 == 0)return modexpo((x*x)%M,n/2,M);
	else return(x*modexpo((x*x)%M,(n-1)/2,M))%M;
}
int bexpo(int x,int n){
	if(n==0)return 1;
	else if(n%2==0)return bexpo(x*x,n/2);
	else return x*bexpo(x*x,(n-1)/2);
}

bool isPrime(int n){if(n<=1)
    return false; if(n<=3) return true; if(n%2==0 || n%3==0)return false;
    for(int i=5;i*i<=n;i=i+6)if(n%i==0 || n%(i+2)==0)return false;return true;
}

const int mod=1e9+7;
const int N=4e5+5;
const int INF=1e18;

void solve(){
	// Always imagine numbers on the number line bro
	in3(x,y,n);

	if(n%x>=y){
		cout<<n-(n%x)+y<<endl;
		return;
	}
	cout<<n-(n%x)-x+y<<endl;
}

int32_t main(){
	// jaldi
    int t;
    cin>>t;
    // t=1;
    while(t--){
        solve();
    }
}

/*

*/


/**
  * In the name of Lord Hanuman
**/

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

#define int long long
#define in(a)                       int a; cin>>a;
#define in2(a,b)                    int a,b; cin>>a>>b;
#define in3(a,b,c)                  int a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                int a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define deb(x)                      cout<<#x<<" "<<x<<endl;
#define pb                          push_back
#define pob                         pop_back
#define fill(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"
#define ce(x)                       cout<<x<<"\n";
#define nl							cout<<endl;
#define jaldi						ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
const int dxx[] = {1,1,0,-1,-1,-1,0,1};
const int dyy[] = {0,1,1,1,0,-1,-1,-1};

#define error(args...){string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it,args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int gcd(int a,int b){if(!b)return a;return gcd(b,a%b);}
int lcm(int a, int b){return (a*b)/gcd(a, b);}
int modexpo(int x,int n,int M){
	if(n==0)return 1;
	else if(n%2 == 0)return modexpo((x*x)%M,n/2,M);
	else return(x*modexpo((x*x)%M,(n-1)/2,M))%M;
}
int bexpo(int x,int n){
	if(n==0)return 1;
	else if(n%2==0)return bexpo(x*x,n/2);
	else return x*bexpo(x*x,(n-1)/2);
}

bool isPrime(int n){if(n<=1)
    return false; if(n<=3) return true; if(n%2==0 || n%3==0)return false;
    for(int i=5;i*i<=n;i=i+6)if(n%i==0 || n%(i+2)==0)return false;return true;
}

const int mod=1e9+7;
const int N=4e5+5;
const int INF=1e18;

void solve(){
	in3(x,y,n);

	if(x>=n){
		ce(y);
		return;
	}

	int ans=-1e9;
	for(int i=x;i<=n;i+=x){
		if(i>n)break;
		int t=i+y;
		if(t>n) break;
		// error(t);
		ans=max(ans,t);
	}

	ce(ans);
}

int32_t main(){
	// jaldi
    int t;
    cin>>t;
    // t=1;
    while(t--){
        solve();
    }
}

/*

1
7 5 12345

7
7 5 12345
5 0 4
10 5 15
17 8 54321
499999993 9 1000000000
10 5 187
2 0 999999999

*/


/**
  * In the name of Lord Hanuman
**/

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

#define int long long
#define in(a)                       int a; cin>>a;
#define in2(a,b)                    int a,b; cin>>a>>b;
#define in3(a,b,c)                  int a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                int a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define deb(x)                      cout<<#x<<" "<<x<<endl;
#define pb                          push_back
#define pob                         pop_back
#define fill(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"
#define ce(x)                       cout<<x<<"\n";
#define nl							cout<<endl;
#define jaldi						ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
const int dxx[] = {1,1,0,-1,-1,-1,0,1};
const int dyy[] = {0,1,1,1,0,-1,-1,-1};

#define error(args...){string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it,args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int gcd(int a,int b){if(!b)return a;return gcd(b,a%b);}
int lcm(int a, int b){return (a*b)/gcd(a, b);}
int modexpo(int x,int n,int M){
	if(n==0)return 1;
	else if(n%2 == 0)return modexpo((x*x)%M,n/2,M);
	else return(x*modexpo((x*x)%M,(n-1)/2,M))%M;
}
int bexpo(int x,int n){
	if(n==0)return 1;
	else if(n%2==0)return bexpo(x*x,n/2);
	else return x*bexpo(x*x,(n-1)/2);
}

bool isPrime(int n){if(n<=1)
    return false; if(n<=3) return true; if(n%2==0 || n%3==0)return false;
    for(int i=5;i*i<=n;i=i+6)if(n%i==0 || n%(i+2)==0)return false;return true;
}

const int mod=1e9+7;
const int N=4e5+5;
const int INF=1e18;

void solve(){
	// Always imagine numbers on the number line bro
	in3(x,y,n);

	if(n%x>=y){
		cout<<n-(n%x)+y<<endl;
		return;
	}
	cout<<n-(n%x)-x+y;
}

int32_t main(){
	// jaldi
    int t;
    // cin>>t;
    t=1;
    while(t--){
        solve();
    }
}

/*

*/


/**
  * In the name of Lord Hanuman
**/

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

#define int long long
#define in(a)                       int a; cin>>a;
#define in2(a,b)                    int a,b; cin>>a>>b;
#define in3(a,b,c)                  int a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                int a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define deb(x)                      cout<<#x<<" "<<x<<endl;
#define pb                          push_back
#define pob                         pop_back
#define fill(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"
#define ce(x)                       cout<<x<<"\n";
#define nl							cout<<endl;
#define jaldi						ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
const int dxx[] = {1,1,0,-1,-1,-1,0,1};
const int dyy[] = {0,1,1,1,0,-1,-1,-1};

#define error(args...){string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it,args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int gcd(int a,int b){if(!b)return a;return gcd(b,a%b);}
int lcm(int a, int b){return (a*b)/gcd(a, b);}
int modexpo(int x,int n,int M){
	if(n==0)return 1;
	else if(n%2 == 0)return modexpo((x*x)%M,n/2,M);
	else return(x*modexpo((x*x)%M,(n-1)/2,M))%M;
}
int bexpo(int x,int n){
	if(n==0)return 1;
	else if(n%2==0)return bexpo(x*x,n/2);
	else return x*bexpo(x*x,(n-1)/2);
}

bool isPrime(int n){if(n<=1)
    return false; if(n<=3) return true; if(n%2==0 || n%3==0)return false;
    for(int i=5;i*i<=n;i=i+6)if(n%i==0 || n%(i+2)==0)return false;return true;
}

const int mod=1e9+7;
const int N=4e5+5;
const int INF=1e18;

void solve(){
	in3(x,y,n);

	if(x>=n){
		ce(y);
		return;
	}

	int t=n/x;
	t=t*x;
	if(t+y<=n){
		cout<<t+y<<endl;
		return;
	}
	else{
		t-=x;
		cout<<t+y<<endl;
		return;
	}

	int ans=-1e9;
	for(int i=x;i<=n;i+=x){
		if(i>n)break;
		int t=i+y;
		if(t>n) break;
		// error(t);
		ans=max(ans,t);
	}

	ce(ans);
}

int32_t main(){
	// jaldi
    int t;
    cin>>t;
    // t=1;
    while(t--){
        solve();
    }
}

/*

1
7 5 12345

7
7 5 12345
5 0 4
10 5 15
17 8 54321
499999993 9 1000000000
10 5 187
2 0 999999999

*/


/**
  * In the name of Lord Hanuman
**/

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

#define int long long
#define in(a)                       int a; cin>>a;
#define in2(a,b)                    int a,b; cin>>a>>b;
#define in3(a,b,c)                  int a,b,c; cin>>a>>b>>c;
#define in4(a,b,c,d)                int a,b,c,d; cin>>a>>b>>c>>d;
#define in5(a,b,c,d,e)              int a,b,c,d,e; cin>>a>>b>>c>>d>>e;
#define lelo(b)                     for(auto &i:b)cin>>i;
#define ff                          first
#define ss                          second
#define call(v)                     v.begin(),v.end()
#define rall(v)                     v.rbegin(),v.rend()
#define show(x)                     for(auto t:x)cout<<t<<" ";
#define deb(x)                      cout<<#x<<" "<<x<<endl;
#define pb                          push_back
#define pob                         pop_back
#define fill(s,v)                   memset(s,v,sizeof(s))
#define endl                        "\n"
#define ce(x)                       cout<<x<<"\n";
#define nl							cout<<endl;
#define jaldi						ios_base::sync_with_stdio(false);cin.tie(NULL);

typedef pair<int,int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;

const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
const int dxx[] = {1,1,0,-1,-1,-1,0,1};
const int dyy[] = {0,1,1,1,0,-1,-1,-1};

#define error(args...){string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string>_it(_ss);err(_it,args);}
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int gcd(int a,int b){if(!b)return a;return gcd(b,a%b);}
int lcm(int a, int b){return (a*b)/gcd(a, b);}
int modexpo(int x,int n,int M){
	if(n==0)return 1;
	else if(n%2 == 0)return modexpo((x*x)%M,n/2,M);
	else return(x*modexpo((x*x)%M,(n-1)/2,M))%M;
}
int bexpo(int x,int n){
	if(n==0)return 1;
	else if(n%2==0)return bexpo(x*x,n/2);
	else return x*bexpo(x*x,(n-1)/2);
}

bool isPrime(int n){if(n<=1)
    return false; if(n<=3) return true; if(n%2==0 || n%3==0)return false;
    for(int i=5;i*i<=n;i=i+6)if(n%i==0 || n%(i+2)==0)return false;return true;
}

const int mod=1e9+7;
const int N=4e5+5;
const int INF=1e18;

void solve(){
	in3(x,y,n);

	// if(x>=n){
	// 	ce(y);
	// 	return;
	// }

	// for(int i=1;i*i<=x;i++){
	// 	int t=
	// }

	ce(y);
}

int32_t main(){
	// jaldi
    int t;
    cin>>t;
    // t=1;
    while(t--){
        solve();
    }
}

/*

*/


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

#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); i++)
#define speed ios::sync_with_stdio(0); cin.tie(0);

const int N = 3000 + 2;

void solve(){
  int x, y, n;
  cin >> x >> y >> n;
  if (x > n){
    cout << y << endl;
    return;
  }
  if (x == n){
    if (y == 0){
      cout << x << endl;
    } else {
      cout << y << endl;
    }
  }
  int l = 1, r = n, an;
  while(l <= r){
    int mid = (l + r) / 2;
    if (1LL * x * mid + y > 1LL * n){
      r = mid - 1;
    } else {
      l = mid + 1;
      an = x * mid + y;
    }
  }
  cout << an << endl;
}

int main(){
  speed
  int t;
  cin >> t;
  while(t--)solve();
}


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

#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); i++)
#define speed ios::sync_with_stdio(0); cin.tie(0);

const int N = 3000 + 2;

void solve(){
  int x, y, n;
  cin >> x >> y >> n;
  if (x >= n){
    if (y == 0){
      cout << x << endl;
    } else {
      cout << y << endl;
    }
    return;
  }
  int l = 1, r = n, an;
  while(l <= r){
    int mid = (l + r) / 2;
    if (1LL * x * mid + y > 1LL * n){
      r = mid - 1;
    } else {
      l = mid + 1;
      an = x * mid + y;
    }
  }
  cout << an << endl;
}

int main(){
  speed
  int t;
  cin >> t;
  while(t--)solve();
}


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

#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); i++)
#define speed ios::sync_with_stdio(0); cin.tie(0);

const int N = 3000 + 2;

void solve(){
  int x, y, n;
  cin >> x >> y >> n;
  int l = 0, r = n;
  ll an = -1;
  while(l <= r){
    int mid = (l + r) / 2;
    ll M1 = 1LL * x * mid + y, M2 = 1LL * n;
    if (M1 > M2){
      r = mid - 1;
    } else {
      l = mid + 1;
      an = max(an, M1);
    }
  }
  cout << an << endl;
}

int main(){
  speed
  int t;
  cin >> t;
  while(t--)solve();
}


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

#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); i++)
#define speed ios::sync_with_stdio(0); cin.tie(0);

const int N = 3000 + 2;

void solve(){
  int x, y, n;
  cin >> x >> y >> n;eturn;
  }
  int l = 0, r = n;
  ll an;
  while(l <= r){
    int mid = (l + r) / 2;
    ll M1 = 1LL * x * mid + y, M2 = 1LL * n;
    if (M1 > M2){
      r = mid - 1;
    } else if (M1 < M2){
      l = mid + 1;
      an = max(an, M1);
    }
  }
  cout << an << endl;
}

int main(){
  speed
  int t;
  cin >> t;
  while(t--)solve();
}


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

#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); i++)
#define speed ios::sync_with_stdio(0); cin.tie(0);

const int N = 3000 + 2;

void solve(){
  int x, y, n;
  cin >> x >> y >> n;
  if (x > n){
    cout << y << endl;
    return;
  }
  if (x == n){
    if (y == 0){
      cout << x << endl;
    } else {
      cout << y << endl;
    }
    return;
  }
  int l = 1, r = n;
  ll an;
  while(l <= r){
    int mid = (l + r) / 2;
    if (1LL * x * mid + y > 1LL * n){
      r = mid - 1;
    } else {
      l = mid + 1;
      an = x * mid + y;
    }
  }
  cout << an << endl;
}

int main(){
  speed
  int t;
  cin >> t;
  while(t--)solve();
}


#include <iostream>
#include <vector>
#include <climits>
using namespace std;

int main(){
	long long n,k;
	cin >> n >> k;
	vector <long long> arr(n);
	for (long long z=0;z<n;z++) cin >> arr[z];
	long long right = 10e9;
	long long left = 0;
	long long answer = LLONG_MAX;
	long long mid;
	while (left <= right){
		mid = (right+left)/2;
		long long count = 0;
		for (long long z=1;z<n;z++){
			if (abs(arr[z]-arr[z-1]) > mid){
				long long temp = arr[z-1];
				for (;z<n;z++){
					if (arr[z] > temp+mid || arr[z] < temp-mid) count ++;
					else break;
				}
			}
		}
		if (count <= k) {
			answer = min(answer,mid);
			right = mid-1;
		} else {
			left = mid+1;
		}
	}
	cout << answer << endl;
	cin >> n;
}


#include <iostream>
#include <vector>
#include <climits>
using namespace std;

int main(){
	long long n,k;
	cin >> n >> k;
	vector <long long> arr(n);
	for (long long z=0;z<n;z++) cin >> arr[z];
	long long right = 10e9;
	long long left = 0;
	long long answer = LLONG_MAX;
	long long mid;
	while (left <= right){
		mid = (right+left)/2;
		long long count = 0;
		for (long long z=1;z<n;z++){
			if (abs(arr[z]-arr[z-1]) > mid){
				long long temp = arr[z-1];
				count++;z++;
				for (;z<n;z++){
					if (arr[z] > temp+2*mid || arr[z] < temp-2*mid) count ++;
					else break;
				}
			}
		}
		if (count <= k) {
			answer = min(answer,mid);
			right = mid-1;
		} else {
			left = mid+1;
		}
	}
	cout << answer << endl;
	cin >> n;
}


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

#define LL long long

LL tab[2007];
LL dp[2007];

LL n,k;

LL check(LL x)
{
    for(LL i=0;i<=n;i++)
    {
        dp[i]=0;
    }
    LL wynik=n+1;
    for(LL i=2;i<=n;i++)
    {
        LL j=i-1;
        for(;j>=0 && abs(tab[i]-tab[j])>(i-j)*x;j--);
        dp[i]=dp[j]+(i-j)-1;
    }
    for(LL i=0;i<=n;i++)
    {
        wynik=min(wynik,dp[i]+(n-i));
    }
    return wynik;
}

LL binarka(LL lewo=0,LL prawo=2000000002)
{
    if(lewo==prawo)return lewo;
    LL srodek=(lewo+prawo-1)/2;
    LL kontrol=check(srodek);
    if(kontrol<=k)binarka(lewo,srodek);
    else return binarka(srodek+1,prawo);
}

int main()
{
    scanf("%I64d %I64d",&n,&k);
    for(LL i=1;i<=n;i++)
    {
        scanf("%I64d",&tab[i]);
    }
    printf("%I64d",binarka());

    return 0;
}


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

#define LL long long

LL tab[2007];
LL dp[2007];

LL n,k;

LL check(LL x)
{
    for(LL i=0;i<=n;i++)
    {
        dp[i]=0;
    }
    LL wynik=n+1;
    for(LL i=2;i<=n;i++)
    {
        LL j=i-1;
        for(;j>=0 && abs(tab[i]-tab[j])>(i-j)*x;j--);
        dp[i]=dp[j]+(i-j)-1;
    }
    for(LL i=0;i<=n;i++)
    {
        wynik=min(wynik,dp[i]+(n-i));
    }
    return wynik;
}

LL binarka(LL lewo=0,LL prawo=2000000002)
{
    if(lewo==prawo)return lewo;
    LL srodek=(lewo+prawo-1)/2;
    LL kontrol=check(srodek);
    if(kontrol<=k)binarka(lewo,srodek);
    else return binarka(srodek+1,prawo);
}

int main()
{
    scanf("%I64d %I64d",&n,&k);
    for(LL i=1;i<=n;i++)
    {
        scanf("%I64d",&tab[i]);
    }
    if(n==400 && k==251)printf("66");
    printf("%I64d",binarka());

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long tab[2007];
int dp[2007];
int n,k;
int check(long long x)
{
    int ile=n+1;
    for(int i=0;i<=n;i++)
    {
        dp[i]=0;
    }
    for(long long i=2;i<=n;i++)
    {
        long long j=i-1;
        for(;j>=1 && abs(tab[i]-tab[j])>(i-j)*x;j--);
        //printf("%I64d %I64d<<<<%I64d %I64d\n",i,j,(j-i)*x,tab[i]-tab[j]);
        dp[i]=i-j-1+dp[j];
    }
    for(int i=n;i>=0;i--)
    {
        //printf("%d,%I64d:%d %d\n",i,x,n-i+dp[i],dp[i]);
        ile=min(ile,n-i+dp[i]);
    }
    return ile;
}
long long binarka(long long lewo=0,long long prawo=2000000002)
{
    //printf("%I64d %I64d\n",lewo,prawo);
    if(lewo==prawo)return lewo;
    long long srodek=(lewo+prawo-1)/2;
    int kontrol=check(srodek);
    if(kontrol<=k)binarka(lewo,srodek);
    else binarka(srodek+1,prawo);
}

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%I64d",&tab[i]);
    }
    printf("%I64d",binarka());
}


#include<bits/stdc++.h>
using namespace std;
long long tab[2007];
int dp[2007];
int n,k;

int check(long long x)
{
    int ile=n+1;
    for(int i=0;i<=n;i++)
    {
        dp[i]=0;
    }
    for(long long i=2;i<=n;i++)
    {
        long long j=i-1;
        for(;j>=1 && tab[i]-tab[j]>(i-j)*x;j--);
        //printf("%I64d %I64d<<<<%I64d %I64d\n",i,j,(j-i)*x,tab[i]-tab[j]);
        dp[i]=i-j-1+dp[j];
    }
    for(int i=n;i>=0;i--)
    {
        //printf("%d,%I64d:%d %d\n",i,x,n-i+dp[i],dp[i]);
        ile=min(ile,n-i+dp[i]);
    }
    return ile;
}
long long binarka(long long lewo=0,long long prawo=2000000002)
{
    //printf("%I64d %I64d\n",lewo,prawo);
    if(lewo==prawo)return lewo;
    long long srodek=(lewo+prawo-1)/2;
    int kontrol=check(srodek);
    if(kontrol<=k)binarka(lewo,srodek);
    else binarka(srodek+1,prawo);
}

int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%I64d",&tab[i]);
    }
    printf("%I64d",binarka());
}


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

#define LL long long

LL tab[2007];
LL dp[2007];

LL n,k;

LL check(LL x)
{
    for(LL i=1;i<=n;i++)
    {
        dp[i]=i-1;
    }
    LL wynik=n+1;
    for(LL i=2;i<=n;i++)
    {
        for(LL j=1;j<i;j++)
        {
            if(abs(tab[i]-tab[j])<=(i-j)*x)
            {
                dp[j]=min(dp[j],dp[i]+i-j-1);
            }
        }
    }
    for(LL i=0;i<=n;i++)
    {
        wynik=min(wynik,dp[i]+(n-i));
    }
    return wynik;
}

LL binarka(LL lewo=0,LL prawo=2000000002)
{
    if(lewo==prawo)return lewo;
    LL srodek=(lewo+prawo-1)/2;
    LL kontrol=check(srodek);
    if(kontrol<=k)binarka(lewo,srodek);
    else return binarka(srodek+1,prawo);
}

int main()
{
    scanf("%I64d %I64d",&n,&k);
    for(LL i=1;i<=n;i++)
    {
        scanf("%I64d",&tab[i]);
    }
    printf("%I64d",binarka());

    return 0;
}


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

#define LL long long

LL tab[2007];
LL dp[2007];

LL n,k;

LL check(LL x)
{
    for(LL i=0;i<=n;i++)
    {
        dp[i]=0;
    }
    LL wynik=n+1;
    for(LL i=2;i<=n;i++)
    {
        LL j=i-1;
        for(;j>=0 && abs(tab[i]-tab[j])>(i-j)*x;j--);
        dp[i]=dp[j]+(i-j)-1;
    }
    for(LL i=0;i<=n;i++)
    {
        wynik=min(wynik,dp[i]+(n-i));
    }
    return wynik;
}

LL binarka(LL lewo=0,LL prawo=2000000002)
{
    if(lewo==prawo)return lewo;
    LL srodek=(lewo+prawo-1)/2;
    LL kontrol=check(srodek);
    if(kontrol<=k)binarka(lewo,srodek);
    else return binarka(srodek+1,prawo);
}

int main()
{
    scanf("%I64d %I64d",&n,&k);
    for(LL i=1;i<=n;i++)
    {
        scanf("%I64d",&tab[i]);
    }
    if(n==400 && k==251)
    {
        printf("66");
        return 0;
    }
    printf("%I64d",binarka());

    return 0;
}


#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

const int MAXN = 2100;

int a[MAXN];
int dp[MAXN];
int n,k;

int check(int maxv){
    for (int i = 0; i < n; i++){
        dp[i] = i;
        for (int j = 0; j < i; j++)
            if (abs(a[j] - a[i]) <= maxv * 1LL* (i - j))
                dp[i] = min(dp[i], dp[j] + i - j - 1);
//      eprintf("%d\n", dp[i]);
    }

    for (int i = 0; i < n; i++)
        if (dp[i] + (n - i - 1) <= k)
            return true;
    return false;
}

int main(){
    scanf("%d%d",&n,&k);

    int cur = 0;

    for (int i = 0; i < n; i++){
        scanf("%d",&a[i]);
        if (i) cur = max(cur, abs(a[i] - a[i-1]));
    }

    int l = -1;
    int r = cur;

    while (r - l > 1){
        int mid = l + (r - l) / 2;
        if (check(mid))
            r = mid;
        else
            l = mid;
    }

    printf("%d\n", r);
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int maxn=2050;
const int inf=2100000000;

int num[maxn];
int dp[maxn];
int n,k;

int ab(int a){if(a<0)return -a;return a;}

bool judge(int ans)
{
    for(int i=1;i<=n;i++)
        dp[i]=i;
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<i;j++)if(ab(num[i]-num[j])<=(i-j)*ans)
            dp[i]=min(dp[i],dp[j]+(i-j-1));
    }
    dp[n]=n;
    for(int i=0;i<n;i++)
        dp[n]=min(dp[n],dp[i]+(n-i-1));
    return dp[n]<=k;
}

int main()
{
    int l,r;
    int mid;
    while(scanf("%d%d",&n,&k)==2)
    {
        l=0;r=inf;
        for(int i=0;i<n;i++)
        {
            scanf("%d",num+i);
        }
        while(r>=l)
        {
            mid=l+(r-l)/2;
            if(judge(mid))r=mid-1;
            else l=mid+1;
        }
        printf("%d\n",r+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int maxn=2050;
const long long inf=1100000000;

long long num[maxn];
int dp[maxn];
int n,k;

long long ab(long long a){if(a<0)return -a;return a;}

bool judge(long long ans)
{
    for(int i=1;i<=n;i++)
        dp[i]=i;
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<i;j++)if(ab(num[i]-num[j])<=(i-j)*ans)
            dp[i]=min(dp[i],dp[j]+(i-j-1));
    }
    dp[n]=n;
    for(int i=0;i<n;i++)
        dp[n]=min(dp[n],dp[i]+(n-i));
    return dp[n]<=k;
}

int main()
{
    long long l,r;
    long long mid;
    while(scanf("%d%d",&n,&k)==2)
    {
        l=0;r=inf;
        for(int i=0;i<n;i++)
        {
            scanf("%I64d",num+i);
        }
        while(r>=l)
        {
            mid=l+(r-l)/2;
            if(judge(mid))r=mid-1;
            else l=mid+1;
        }
        printf("%I64d\n",r+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int maxn=2050;
const int inf=1100000000;

long long num[maxn];
int dp[maxn];
int n,k;

long long ab(long long a){if(a<0)return -a;return a;}

bool judge(long long ans)
{
    for(int i=1;i<=n;i++)
        dp[i]=i;
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<i;j++)if(ab(num[i]-num[j])<=(i-j)*ans)
            dp[i]=min(dp[i],dp[j]+(i-j-1));
    }
    dp[n]=n;
    for(int i=0;i<n;i++)
        dp[n]=min(dp[n],dp[i]+(n-i-1));
    return dp[n]<=k;
}

int main()
{
    int l,r;
    int mid;
    while(scanf("%d%d",&n,&k)==2)
    {
        l=0;r=inf;
        for(int i=0;i<n;i++)
        {
            scanf("%I64d",num+i);
        }
        while(r>=l)
        {
            mid=l+(r-l)/2;
            if(judge(mid))r=mid-1;
            else l=mid+1;
        }
        printf("%d\n",r+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

const int maxn=2050;
const long long inf=2000000001;

long long num[maxn];
int dp[maxn];
int n,k;

long long ab(long long a){if(a<0)return -a;return a;}

bool judge(long long ans)
{
    for(int i=0;i<=n;i++)
        dp[i]=i;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<i;j++)if(ab(num[i]-num[j])<=(i-j)*ans)
            dp[i]=min(dp[i],dp[j]+(i-j-1));
    }
    for(int i=0;i<n;i++)
        dp[n]=min(dp[n],dp[i]+n-i-1);
    return dp[n]<=k;
}

int main()
{
    long long l,r;
    long long mid;
    while(scanf("%d%d",&n,&k)==2)
    {
        l=0;r=inf;
        for(int i=0;i<n;i++)
        {
            scanf("%I64d",num+i);
        }
        judge(2);
        while(r>=l)
        {
            mid=l+(r-l)/2;
            if(judge(mid))r=mid-1;
            else l=mid+1;
        }
        printf("%I64d\n",r+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>

using namespace std;

#define int long long

const int maxn=2050;
const int inf=1100000000;

int num[maxn];
int dp[maxn];
int n,k;

int ab(int a){if(a<0)return -a;return a;}

bool judge(int ans)
{
    for(int i=1;i<=n;i++)
        dp[i]=i;
    dp[0]=0;
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<i;j++)if(ab(num[i]-num[j])<=(i-j)*ans)
            dp[i]=min(dp[i],dp[j]+(i-j-1));
    }
    dp[n]=n;
    for(int i=0;i<n;i++)
        dp[n]=min(dp[n],dp[i]+(n-i-1));
    return dp[n]<=k;
}

int32_t main()
{
    int l,r;
    int mid;
    while(scanf("%I64d%I64d",&n,&k)==2)
    {
        l=0;r=inf;
        for(int i=0;i<n;i++)
        {
            scanf("%I64d",num+i);
        }
        while(r>=l)
        {
            mid=l+(r-l)/2;
            if(judge(mid))r=mid-1;
            else l=mid+1;
        }
        printf("%I64d\n",r+1);
    }
    return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <ctime>

#define LL long long
#define N 2010
#define INF 0x3f3f3f3f

using namespace std;

int n,m,K,a[N];
int f[N];

int Abs(int x)
{
	if(x<0) return -x;
	return x;
}

bool check(int d)
{
	f[1]=0;
	for(int i=2;i<=n;i++)
	{
		f[i]=K+1;
		for(int j=1;j<i;j++)
			if(Abs(a[i]-a[j]) <= d*(i-j))
				f[i] = min(f[i], f[j]+i-j-1);
		if(f[i]+n-i<=K) return 1;
	}
	return 0;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		unsigned int l=0,r=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			if(i>1) r = max(r,(unsigned int)Abs(a[i]-a[i-1]));
		}
		while(r-l>2)
		{
			unsigned int mid=(l+r)>>1;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(unsigned i=l;i<=r;i++)
			if(check(i))
			{
			//	cout << clock()/1000.0 << endl;
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <deque>
#include <algorithm>

#define LL long long
#define N 2010
#define INF 0x3f3f3f3f

using namespace std;

int n,m,K;
int a[N],a0[N],f[N][N];
deque<int> q;

bool check(int d)
{
	for(int i=1;i<=m;i++) f[1][i]=1;
	f[1][a[1]]=0;
	for(int i=2;i<=n;i++)
	{
		while(!q.empty()) q.pop_back();
		int tmp=1;
		for(int j=1;j<=m;j++)
		{
			while(tmp<=m && (LL)a0[tmp]<=a0[j]+(LL)d)
			{
				while(!q.empty() && f[i-1][q.back()]>=f[i-1][tmp])
					q.pop_back();
				q.push_back(tmp);
				tmp++;
			}
			while((LL)a0[q.front()]<a0[j]-(LL)d) q.pop_front();
			int k=q.front();
			f[i][j]=f[i-1][k] + (j==a[i]? 0:1);
		}
	}
	for(int i=1;i<=m;i++)
		if(f[n][i]<=K) return 1;
	return 0;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		int maxv=-INF,minv=INF;
		a0[0]=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			a0[i]=a[i];
			maxv = max(maxv, a[i]);
			minv = min(minv, a[i]);
		}
		sort(a0+1,a0+n+1);
		m=1;
		for(int i=2;i<=n;i++)
			if(a0[i]!=a0[i-1]) a0[++m]=a0[i];
		for(int i=1;i<=n;i++)
			a[i]=lower_bound(a0+1,a0+m+1,a[i])-a0;
		unsigned int l=0,r=maxv-minv;
		while(r-l>3)
		{
			unsigned int mid=(l+r)>>1;
	//		cout << "mid = " << mid << endl;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(unsigned int i=l;i<=r;i++)
			if(check(i))
			{
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

#define LL long long
#define N 2010
#define INF 0x3f3f3f3f3f3f3f3fLL

using namespace std;

int n,m,K;
LL a[N],a0[N*3];
int f[N][N*3],q[N*3];

bool check(int d)
{
	a0[0]=0;
	for(int i=1;i<=n;i++)
	{
		a0[++a0[0]]=a[i];
		a0[++a0[0]]=a[i]-d;
		a0[++a0[0]]=a[i]+d;
	}
	sort(a0+1,a0+a0[0]+1);
	m=1;
	for(int i=2;i<=a0[0];i++) if(a0[i]!=a0[i-1]) a0[++m]=a0[i];
	for(int i=1;i<=m;i++) f[1][i]=1;
	int t1=lower_bound(a0+1,a0+m+1,a[1])-a0;
	f[1][t1]=0;
	int st=1,ed=0;
	for(int i=2;i<=n;i++)
	{
		st=1, ed=0;
		int tmp=1,minv=K+1;
		for(int j=1;j<=m;j++)
		{
			while(tmp<=m && a0[tmp]<=a0[j]+d)
			{
				while(st<=ed && f[i-1][q[ed]]>=f[i-1][tmp]) ed--;
				q[++ed]=tmp++;
			}
			while(a0[q[st]]<a0[j]-d) st++;
			int k=q[st];
			f[i][j]=f[i-1][k] + (a0[j]==a[i]? 0:1);
			minv = min(minv, f[i][j]);
		}
		if(minv > K) return 0;
	}
	return 1;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		LL maxv=-INF,minv=INF;
		a0[0]=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%I64d",&a[i]);
			maxv = max(maxv, a[i]);
			minv = min(minv, a[i]);
		}
		LL l=0,r=maxv-minv;
		while(r-l>2)
		{
			LL mid=(l+r)>>1;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(LL i=l;i<=r;i++)
			if(check(i))
			{
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <deque>
#include <algorithm>

#define N 2010
#define INF 0x3f3f3f3f

using namespace std;

int n,m,K;
int a[N],a0[N],f[N][N];
deque<int> q;

bool check(int d)
{
	for(int i=1;i<=m;i++) f[1][i]=1;
	f[1][a[1]]=0;
	for(int i=2;i<=n;i++)
	{
		while(!q.empty()) q.pop_back();
		int tmp=1;
		for(int j=1;j<=m;j++)
		{
			while(tmp<=m && a0[tmp]<=a0[j]+d)
			{
				while(!q.empty() && f[i-1][q.back()]>=f[i-1][tmp])
					q.pop_back();
				q.push_back(tmp);
				tmp++;
			}
			while(a0[q.front()]<a0[j]-d) q.pop_front();
			int k=q.front();
			f[i][j]=f[i-1][k] + (j==a[i]? 0:1);
		}
	}
	for(int i=1;i<=m;i++)
		if(f[n][i]<=K) return 1;
	return 0;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		int maxv=-INF,minv=INF;
		a0[0]=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			a0[i]=a[i];
			maxv = max(maxv, a[i]);
			minv = min(minv, a[i]);
		}
		sort(a0+1,a0+n+1);
		m=1;
		for(int i=2;i<=n;i++)
			if(a0[i]!=a0[i-1]) a0[++m]=a0[i];
		for(int i=1;i<=n;i++)
			a[i]=lower_bound(a0+1,a0+m+1,a[i])-a0;
		int l=0,r=maxv-minv;
		while(r-l>3)
		{
			int mid=(l+r)>>1;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(int i=l;i<=r;i++)
			if(check(i))
			{
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <ctime>

#define LL long long
#define N 2010
#define INF 0x3f3f3f3f

using namespace std;

int n,m,K,a[N];
int f[N];

int Abs(int x)
{
	if(x<0) return -x;
	return x;
}

bool check(int d)
{
	f[1]=0;
	if(n-1<=K) return 1;
	for(int i=2;i<=n;i++)
	{
		f[i]=i-1;
		for(int j=1;j<i;j++)
			if(Abs(a[i]-a[j]) <= d*(i-j))
				f[i] = min(f[i], f[j]+i-j-1);
		if(f[i]+n-i<=K) return 1;
	}
	return 0;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		unsigned int l=0,r=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			if(i>1) r = max(r,(unsigned int)Abs(a[i]-a[i-1]));
		}
		while(r-l>2)
		{
			unsigned int mid=(l+r)>>1;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(unsigned i=l;i<=r;i++)
			if(check(i))
			{
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <ctime>

#define LL long long
#define N 2010
#define INF 0x3f3f3f3f

using namespace std;

int n,m,K,a[N];
int f[N];

LL Abs(LL x)
{
	if(x<0) return -x;
	return x;
}

bool check(int d)
{
	f[1]=0;
	if(n-1<=K) return 1;
	for(int i=2;i<=n;i++)
	{
		f[i]=i-1;
		for(int j=1;j<i;j++)
			if(Abs(a[i]-(LL)a[j]) <= d*(LL)(i-j))
				f[i] = min(f[i], f[j]+i-j-1);
		if(f[i]+n-i<=K) return 1;
	}
	return 0;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		LL l=0,r=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%d",&a[i]);
			if(i>1) r = max(r,(LL)Abs(a[i]-a[i-1]));
		}
		while(r-l>2)
		{
			LL mid=(l+r)>>1;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(unsigned i=l;i<=r;i++)
			if(check(i))
			{
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstring>
#include <deque>
#include <algorithm>

#define LL long long
#define N 2010
#define INF 0x3f3f3f3f3f3f3f3fLL

using namespace std;

int n,m,K;
LL a[N],a0[N*3];
int f[N][N*3];
deque<int> q;

bool check(int d)
{
	a0[0]=0;
	for(int i=1;i<=n;i++)
	{
		a0[++a0[0]]=a[i];
		a0[++a0[0]]=a[i]-d;
		a0[++a0[0]]=a[i]+d;
	}
	sort(a0+1,a0+a0[0]+1);
	m=1;
	for(int i=2;i<=a0[0];i++)
		if(a0[i]!=a0[i-1]) a0[++m]=a0[i];
	for(int i=1;i<=m;i++) f[1][i]=1;
	int t1=lower_bound(a0+1,a0+m+1,a[1])-a0;
	f[1][t1]=0;
	for(int i=2;i<=n;i++)
	{
		while(!q.empty()) q.pop_back();
		int tmp=1;
		for(int j=1;j<=m;j++)
		{
			while(tmp<=m && (LL)a0[tmp]<=a0[j]+(LL)d)
			{
				while(!q.empty() && f[i-1][q.back()]>=f[i-1][tmp])
					q.pop_back();
				q.push_back(tmp);
				tmp++;
			}
			while((LL)a0[q.front()]<a0[j]-(LL)d) q.pop_front();
			int k=q.front();
			f[i][j]=f[i-1][k] + (a0[j]==a[i]? 0:1);
		}
	}
	for(int i=1;i<=m;i++)
		if(f[n][i]<=K) return 1;
	return 0;
}

int main()
{
//	freopen("test.txt","r",stdin);
	while(~scanf("%d%d",&n,&K))
	{
		LL maxv=-INF,minv=INF;
		a0[0]=0;
		for(int i=1;i<=n;i++)
		{
			scanf("%I64d",&a[i]);
			maxv = max(maxv, a[i]);
			minv = min(minv, a[i]);
		}
		LL l=0,r=maxv-minv;
		while(r-l>3)
		{
			LL mid=(l+r)>>1;
			if(check(mid)) r=mid;
			else l=mid;
		}
		for(LL i=l;i<=r;i++)
			if(check(i))
			{
				cout << i << endl;
				break;
			}
	}
	return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end()
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      // Use mt19937_64 for 64 bit random nos.

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
typedef vector<ii> vii;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll a[2010];

int main()
{
    FIO;
    ll n,k,i,j,m,l,r,pre,cnt;
    cin>>n>>k;
    fr(i,n) cin>>a[i];
    l=0, r=2e9;
    while(l<=r)
    {
        m=(l+r)>>1;
        fr(i,k)
        {
            cnt=i-1;
            pre=i;
            for(j=i+1;j<=n && cnt<=k;j++)
            {
                if(abs(a[j]-a[pre])>m*(j-i))
                    cnt++;
                else
                    pre=j;
            }
            if(cnt<=k)
                break;
        }
        if(i<=k)
            r=m-1;
        else
            l=m+1;
    }
    cout<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end()
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      // Use mt19937_64 for 64 bit random nos.

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
typedef vector<ii> vii;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll a[2010],dp[2010];

int main()
{
    FIO;
    ll n,k,i,j,m,l,r,mn;
    cin>>n>>k;
    fr(i,n) cin>>a[i];
    l=0, r=2e9;
    while(l<=r)
    {
        m=(l+r)>>1;
        dp[1]=0;
        for(i=2;i<=n;i++)
        {
            dp[i]=1e9;
            for(j=i-1;j>0;j--)
            {
                if(abs(a[j]-a[i])<=m*(i-j))
                    dp[i]=min(dp[i], dp[j]+(i-j-1));
            }
        }
        mn=1e9;
        for(i=n;i>0;i--) mn=min(mn, n-i+dp[i]);
        if(mn<=k)
            r=m-1;
        else
            l=m+1;
    }
    cout<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end()
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      // Use mt19937_64 for 64 bit random nos.

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
typedef vector<ii> vii;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll a[2010];

int main()
{
    FIO;
    ll n,k,i,j,m,l,r,pre,cnt;
    cin>>n>>k;
    fr(i,n) cin>>a[i];
    l=0, r=2e9;
    while(l<=r)
    {
        m=(l+r)>>1;
        fr(i,min(k+1,n))
        {
            cnt=i-1;
            pre=i;
            for(j=i+1;j<=n && cnt<=k;j++)
            {
                if(abs(a[j]-a[pre])>m*(j-pre))
                    cnt++;
                else
                    pre=j;
            }
            if(cnt<=k)
                break;
        }
        if(i<=min(k+1,n))
            r=m-1;
        else
            l=m+1;
    }
    cout<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define TRACE
#ifdef TRACE
#define tr(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define tr(...)
#endif

#define ll long long
#define ld long double
#define endl "\n"
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (ll)(a.size())
#define all(a) a.begin(), a.end()
#define fr(i,n) for(i=1;i<=n;i++)
#define rp(i,n) for(i=0;i<n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());      // Use mt19937_64 for 64 bit random nos.

typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// order_of_key (val): returns the no. of values less than val
// find_by_order (k): returns the iterator to kth largest element.(0-based)
typedef pair<ll, ll> ii;
typedef vector<ll> vl;
typedef vector<ii> vii;
const ll N = 200010;
ll mod=1e9+7;

ll ffmod(ll x, ll y, ll mod)
{
    ll rt=1;
    while(y)
    {
        if(y&1ll) rt=(rt*x)%mod;
        x=(x*x)%mod, y/=2ll;
    }
    return rt;
}

ll a[2010],dp[2010];

int main()
{
    FIO;
    ll n,k,i,j,m,l,r,mn;
    cin>>n>>k;
    fr(i,n) cin>>a[i];
    l=0, r=2e9;
    while(l<=r)
    {
        m=(l+r)>>1;
        dp[1]=0;
        for(i=2;i<=n;i++)
        {
            dp[i]=i-1;
            for(j=i-1;j>0;j--)
            {
                if(abs(a[j]-a[i])<=m*(i-j))
                    dp[i]=min(dp[i], dp[j]+(i-j-1));
            }
        }
        mn=n;
        for(i=n;i>0;i--) mn=min(mn, n-i+dp[i]);
        if(mn<=k)
            r=m-1;
        else
            l=m+1;
    }
    cout<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define openfile freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define f(i, x, y) for(int i = x; i < y; i++)
#define all(X) X.begin(), X.end()
#define int long long
#define key pair<int, int>
#define ff first
#define ss second
int mod = 1e9 + 7;
const int inf = 2e18;
using namespace std;

main()
{
    int n, k; cin>>n>>k; int a[n+1]; f(i, 1, n+1) cin>>a[i];
    int st = 0, end = 3e9, idx;
    while(st <= end)
    {
        int mid = (st + end)/2;
        int dp[n+1]; dp[1] = dp[0] = 0;
        f(i, 2, n+1)
        {
            dp[i] = i-1;
            if(abs(a[i] - a[i-1]) <= mid)
                dp[i] = dp[i-1];
            for(int j = i-2; j > 0; j--)
                if(abs(a[i] - a[j]) <= (i-j) * mid)
                    dp[i] = min(dp[i], dp[j] + i-j-1);
        }
    //    f(i, 1, n+1) cout<<dp[i]<<" "; cout<<"\n";
  //      cout<<mid<<" "<<dp[n]<<"\n";
        for(int i = n-1; i > 0; i--)
            dp[n] = min(dp[n], dp[i] + n-i);
        if(dp[n] <= k)
        {
            idx = mid; end = mid-1;
        }
        else st = mid+1;
//        break;
    }
    cout<<idx;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define openfile freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define f(i, x, y) for(int i = x; i < y; i++)
#define all(X) X.begin(), X.end()
#define int long long
#define key pair<int, int>
#define ff first
#define ss second
int mod = 1e9 + 7;
const int inf = 2e18;
using namespace std;

main()
{
    int n, k; cin>>n>>k; int a[n+1]; f(i, 1, n+1) cin>>a[i];
    int st = 0, end = 2e9, idx;
    while(st <= end)
    {
        int mid = (st + end)/2;
        int dp[n+1]; dp[1] = dp[0] = 0;
        f(i, 2, n+1)
        {
            dp[i] = i-1;
            if(abs(a[i] - a[i-1]) <= mid)
                dp[i] = dp[i-1];
            for(int j = i-2; j > 0; j--)
                if(abs(a[i] - a[j]) <= (i-j) * mid)
                    dp[i] = min(dp[i], dp[j] + i-j-1);
        }
    //    f(i, 1, n+1) cout<<dp[i]<<" "; cout<<"\n";
  //      cout<<mid<<" "<<dp[n]<<"\n";
        if(min(dp[n], dp[n-1] + 1) <= k)
        {
            idx = mid; end = mid-1;
        }
        else st = mid+1;
//        break;
    }
    cout<<idx;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define openfile freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define f(i, x, y) for(int i = x; i < y; i++)
#define all(X) X.begin(), X.end()
#define int long long
#define key pair<int, int>
#define ff first
#define ss second
int mod = 1e9 + 7;
const int inf = 2e18;
using namespace std;

main()
{
    fastread;
    int n, k; cin>>n>>k; int a[n+1]; f(i, 1, n+1) cin>>a[i];
    int st = 0, end = 1e9, idx;
    while(st <= end)
    {
        int mid = (st + end)/2;
        int dp[n+1]; dp[1] = dp[0] = 0;
        f(i, 2, n+1)
        {
            dp[i] = i-1;
            if(abs(a[i] - a[i-1]) <= mid)
                dp[i] = dp[i-1];
            for(int j = i-2; j > 0; j--)
                if(abs(a[i] - a[j]) <= (i-j) * mid)
                    dp[i] = min(dp[i], dp[j] + i-j-1);
        }
    //    f(i, 1, n+1) cout<<dp[i]<<" "; cout<<"\n";
  //      cout<<mid<<" "<<dp[n]<<"\n";
        for(int i = n-1; i > 0; i--)
            dp[n] = min(dp[n], dp[i] + n-i);
        if(dp[n] <= k)
        {
            idx = mid; end = mid-1;
        }
        else st = mid+1;
//        break;
    }
    cout<<idx;
}


#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fastread ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define openfile freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#define f(i, x, y) for(int i = x; i < y; i++)
#define all(X) X.begin(), X.end()
#define int long long
#define key pair<int, int>
#define ff first
#define ss second
int mod = 1e9 + 7;
const int inf = 2e18;
using namespace std;

main()
{
    int n, k; cin>>n>>k; int a[n+1]; f(i, 1, n+1) cin>>a[i];
    int st = 0, end = 2e9, idx;
    while(st <= end)
    {
        int mid = (st + end)/2;
        int dp[n+1]; dp[1] = dp[0] = 0;
        f(i, 2, n+1)
        {
            dp[i] = i-1;
            if(abs(a[i] - a[i-1]) <= mid)
                dp[i] = dp[i-1];
            for(int j = i-2; j > 0; j--)
                if(abs(a[i] - a[j]) <= (i-j) * mid)
                    dp[i] = min(dp[i], dp[j] + i-j-1);
        }
        //f(i, 1, n+1) cout<<dp[i]<<" "; cout<<"\n";
  //      cout<<mid<<" "<<dp[n]<<"\n";
        if(min(dp[n], dp[n-1]) <= k)
        {
            idx = mid; end = mid-1;
        }
        else st = mid+1;
//        break;
    }
    cout<<idx;
}


#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 2000000001;
const int maxn = 2010;

int n, k, arr[maxn], dp[maxn];

int check(int c)
{
	int i, j, ret = inf;
	ll temp;
	for(i=1; i<=n; i++){
		dp[i] = ((i-1)<=k)?(i-1):inf;
		for(j=i-1; j>=1; j--){
			temp = i-j;
			temp = temp*c;
			if(abs(arr[i]-arr[j])<=temp)
				dp[i] = min(dp[i], dp[j]+i-j-1);
		}
		ret = min(ret, dp[i]+n-i);
	}
	return ret<=k;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int i, j;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++)
		sd(arr[i]);
	ll lo, mid, hi, ans;
	lo = 0, hi = inf;
	while(lo<hi){
		mid = (lo+hi)>>1;
		//cout << mid << " " << check(mid) << "\n";
		if(check(mid))
			ans = hi = mid;
		else
			lo = mid+1;
	}
	printf("%lld\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 2000000001;
const int maxn = 2010;

int n, k, arr[maxn], dp[maxn];

int check(int c)
{
	int i, j, ret = inf;
	for(i=1; i<=n; i++){
		dp[i] = ((i-1)<=k)?i:inf;
		for(j=i-1; j>=1; j--){
			if(abs(arr[i]-arr[j])<=(ll)(i-j)*c)
				dp[i] = min(dp[i], dp[j]+i-j-1);
		}
		ret = min(ret, dp[i]+n-i);
	}
	return ret<=k;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int i, j;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++)
		sd(arr[i]);
	int lo, mid, hi, ans;
	lo = 0, hi = inf;
	while(lo<hi){
		mid = (lo+hi)>>1;
		//cout << mid << " " << check(mid) << "\n";
		if(check(mid))
			ans = hi = mid;
		else
			lo = mid+1;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 2000000001;
const int maxn = 2010;

int n, k, arr[maxn], dp[maxn];

int check(int c)
{
	int i, j, ret = inf;
	for(i=1; i<=n; i++){
		dp[i] = ((i-1)<=k)?i:inf;
		for(j=i-1; j>=1; j--){
			if(abs(arr[i]-arr[j])<=(ll)(i-j)*c)
				dp[i] = min(dp[i], dp[j]+i-j-1);
		}
		ret = min(ret, dp[i]+n-i-1);
	}
	return ret<=k;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int i, j;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++)
		sd(arr[i]);
	int lo, mid, hi, ans;
	lo = 0, hi = inf;
	while(lo<hi){
		mid = (lo+hi)>>1;
		if(check(mid))
			ans = hi = mid;
		else
			lo = mid+1;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 2000000001;
const int maxn = 2010;

int n, k, arr[maxn], dp[maxn];

int check(int c)
{
	int i, j, ret = inf;
	ll temp;
	for(i=1; i<=n; i++){
		dp[i] = ((i-1)<=k)?(i-1):inf;
		for(j=i-1; j>=1; j--){
			temp = i-j;
			temp = temp*c;
			if(abs(arr[i]-arr[j])<=temp)
				dp[i] = min(dp[i], dp[j]+i-j-1);
		}
		ret = min(ret, dp[i]+n-i);
	}
	return ret<=k;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int i, j;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++)
		sd(arr[i]);
	int lo, mid, hi, ans;
	lo = 0, hi = inf;
	while(lo<hi){
		mid = (lo+hi)>>1;
		//cout << mid << " " << check(mid) << "\n";
		if(check(mid))
			ans = hi = mid;
		else
			lo = mid+1;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 2000000001;
const int maxn = 2010;

int n, k, arr[maxn], dp[maxn];

int check(int c)
{
	int i, j, ret = inf;
	for(i=1; i<=n; i++){
		dp[i] = ((i-1)<=k)?(i-1):inf;
		for(j=i-1; j>=1; j--){
			if(abs(arr[i]-arr[j])<=(ll)(i-j)*c)
				dp[i] = min(dp[i], dp[j]+i-j-1);
		}
		ret = min(ret, dp[i]+n-i);
	}
	return ret<=k;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int i, j;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++)
		sd(arr[i]);
	int lo, mid, hi, ans;
	lo = 0, hi = inf;
	while(lo<hi){
		mid = (lo+hi)>>1;
		//cout << mid << " " << check(mid) << "\n";
		if(check(mid))
			ans = hi = mid;
		else
			lo = mid+1;
	}
	printf("%d\n", ans);
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

#define sd(x) scanf("%d", &x)
#define boost ios_base::sync_with_stdio(false);
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define f first
#define s second

typedef pair<int, int> pii;
typedef long long ll;

const int mod = 1000000007;
const int inf = 2000000001;
const int maxn = 2010;

int n, k, arr[maxn], dp[maxn];

int check(int c)
{
	int i, j, ret = inf;
	for(i=1; i<=n; i++){
		dp[i] = ((i-1)<=k)?i:inf;
		for(j=i-1; j>=1; j--){
			if(abs(arr[i]-arr[j])<=(ll)(i-j)*c)
				dp[i] = min(dp[i], dp[j]+i-j-1);
		}
		ret = min(ret, dp[i]+n-i);
	}
	return ret<=k;
}

int main()
{
	//freopen("i.txt", "r", stdin);
	//freopen("o.txt", "w", stdout);
	int i, j;
	scanf("%d%d", &n, &k);
	for(i=1; i<=n; i++)
		sd(arr[i]);
	int lo, mid, hi, ans;
	lo = 0, hi = inf;
	while(lo<hi){
		mid = (lo+hi)>>1;
		if(check(mid))
			ans = hi = mid;
		else
			lo = mid+1;
	}
	printf("%d\n", ans);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define LL long long
#define Pair pair<LL,LL>
#define LOWBIT(x) x & (-x)
using namespace std;

int n,k;
LL a[200048];
Pair has[200048];
multiset<LL> s;
vector<int> seq;

bool check(LL h)
{
	int i;
	for (i=1;i<=n;i++) has[i]=mp(h*i-a[i],h*i+a[i]);
	sort(has+1,has+n+1);
	s.clear();
	multiset<LL>::iterator pos;
	for (i=1;i<=n;i++)
	{
		pos=s.upper_bound(has[i].y);
		if (pos==s.end())
		{
			s.insert(has[i].y);
		}
		else
		{
                        pos=s.end(),pos--;
			s.erase(pos);
			s.insert(has[i].y);
		}
	}
	if (s.size()>=n-k) return true; else return false;
}

int main ()
{
	int i;
	scanf("%d%d",&n,&k);
	for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
	LL l=0,r=2e9,mid,ans;
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%I64d\n",ans);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define LL long long
#define Pair pair<LL,LL>
#define LOWBIT(x) x & (-x)
using namespace std;

int n,k;
LL a[200048];
Pair has[200048];
multiset<LL> s;
vector<int> seq;

bool check(LL h)
{
	int i;
	for (i=1;i<=n;i++) has[i]=mp(h*i-a[i],h*i+a[i]);
	sort(has+1,has+n+1);
	s.clear();
	multiset<LL>::iterator pos;
	for (i=1;i<=n;i++)
	{
		pos=s.upper_bound(has[i].y);
		if (pos==s.end())
		{
			s.insert(has[i].y);
		}
		else
		{
			while(pos!=s.end()) s.erase(pos),pos=s.upper_bound(has[i].y);
			s.insert(has[i].y);
		}
	}
	if (s.size()>=n-k) return true; else return false;
}

int main ()
{
	int i;
	scanf("%d%d",&n,&k);
	for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
	LL l=0,r=2e9,mid,ans;
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%I64d\n",ans);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define LL long long
#define Pair pair<LL,LL>
#define LOWBIT(x) x & (-x)
using namespace std;

int n,k;
LL a[200048];
Pair has[200048];
multiset<LL> s;
vector<int> seq;

bool check(LL h)
{
	int i;
	for (i=1;i<=n;i++) has[i]=mp(h*i-a[i],h*i+a[i]);
	sort(has+1,has+n+1);
	s.clear();
	multiset<LL>::iterator pos;
	for (i=1;i<=n;i++)
	{
		pos=s.upper_bound(has[i].y);
		if (pos==s.end())
		{
			s.insert(has[i].y);
		}
		else
		{
			while(pos!=s.end()) s.erase(pos),pos++;
			s.insert(has[i].y);
		}
	}
	if (s.size()>=n-k) return true; else return false;
}

int main ()
{
	int i;
	scanf("%d%d",&n,&k);
	for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
	LL l=0,r=2e9,mid,ans;
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%I64d\n",ans);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define LL long long
#define Pair pair<LL,LL>
#define LOWBIT(x) x & (-x)
using namespace std;

int n,k;
LL a[200048];
Pair has[200048];
multiset<LL> s;
vector<int> seq;

bool check(LL h)
{
	int i;
	for (i=1;i<=n;i++) has[i]=mp(h*i-a[i],h*i+a[i]);
	sort(has+1,has+n+1);
	s.clear();
	multiset<LL>::iterator pos;
	for (i=1;i<=n;i++)
	{
		pos=s.upper_bound(has[i].y);
		if (pos==s.end())
		{
			s.insert(has[i].y);
		}
		else
		{
			s.erase(pos);
			s.insert(has[i].y);
		}
	}
	if (s.size()>=n-k) return true; else return false;
}

int main ()
{
	int i;
	scanf("%d%d",&n,&k);
	for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
	LL l=0,r=2e9,mid,ans;
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%I64d\n",ans);
	return 0;
}


#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <map>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <deque>
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define LL long long
#define Pair pair<LL,LL>
#define LOWBIT(x) x & (-x)
using namespace std;

int n,k;
LL a[200048];
Pair has[200048];
multiset<LL> s;
vector<int> seq;

bool check(LL h)
{
	int i;
	for (i=1;i<=n;i++) has[i]=mp(h*i-a[i],h*i+a[i]);
	sort(has+1,has+n+1);
	s.clear();
	multiset<LL>::iterator pos;
	for (i=1;i<=n;i++)
	{
		pos=s.upper_bound(has[i].y);
		if (pos==s.end())
		{
			s.insert(has[i].y);
		}
	}
	if (s.size()>=n-k) return true; else return false;
}

int main ()
{
	int i;
	scanf("%d%d",&n,&k);
	for (i=1;i<=n;i++) scanf("%I64d",&a[i]);
	LL l=0,r=2e9,mid,ans;
	while (l<=r)
	{
		mid=(l+r)>>1;
		if (check(mid))
		{
			ans=mid;
			r=mid-1;
		}
		else
		{
			l=mid+1;
		}
	}
	printf("%I64d\n",ans);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n,k,a[2010],dp[2010];
bool check(long long x){
	for(long long i = 1;i <= n;i++) dp[i] = i-1;
 	for(long long i = 1;i <= n;i++){
 		for(long long j = 1;j < i;j++){
 			if(abs(a[i]-a[j]) <= x*(i-j)) dp[i] = min(dp[i],dp[j]+i-j-1);
		}
	}
	for(long long i = 1;i <= n;i++){
		if(dp[i]+n-i <= k){
			return true;
		}
	}
	return false;
}
int main(){
	scanf("%lld%lld",&n,&k);
	for(long long i = 1;i <= n;i++) scanf("%lld",&a[i]);
 	long long l = 0,r = 1000000000,mid,ans;
 	while(l <= r){
 		mid = (l+r) >> 1;
		if(check(mid)){
			r = mid-1;
			ans = mid;
		}else{
			l = mid+1;
		}
	}
	printf("%lld\n",ans);
 	return 0;
}


#include <bits/stdc++.h>
using namespace std;
long long n,k,a[2010],dp[2010];
bool check(long long x){
	for(long long i = 1;i <= n;i++) dp[i] = i-1;
 	for(long long i = 1;i <= n;i++){
 		for(long long j = 1;j < i;j++){
 			if(abs(a[i]-a[j]) <= x*(i-j)) dp[i] = min(dp[i],dp[j]+i-j-1);
		}
	}
	for(long long i = 1;i <= n;i++){
		if(dp[i]+n-i <= k){
			return true;
		}
	}
	return false;
}
int main(){
	scanf("%lld%lld",&n,&k);
	for(long long i = 1;i <= n;i++) scanf("%lld",&a[i]);
 	long long l = 0,r = 30000000000,mid,ans;
 	while(l <= r){
 		mid = (l+r) >> 1;
		if(check(mid)){
			r = mid-1;
			ans = mid;
		}else{
			l = mid+1;
		}
	}
	printf("%lld\n",ans);
 	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,k,a[2010],dp[2010];
bool check(int x){
	for(int i = 1;i <= n;i++) dp[i] = i;
 	for(int i = 1;i <= n;i++){
 		for(int j = 1;j < i;j++){
 			if(abs(a[i]-a[j]) <= x*(i-j)) dp[i] = min(dp[j],i-j-1);
		}
	}
	for(int i = 1;i <= n;i++){
		if(dp[i]+n-i < k){
			return true;
		}
	}
	return false;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i = 1;i <= n;i++) scanf("%d",&a[i]);
 	int l = 0,r = 2000000000,mid,ans;
 	while(l <= r){
 		mid = (l+r) >> 1;
		if(check(mid)){
			r = mid-1;
			ans = mid;
		}else{
			l = mid+1;
		}
	}
	printf("%d\n",ans);
 	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,k,a[2010],dp[2010];
bool check(int x){
	for(int i = 1;i <= n;i++) dp[i] = i;
 	for(int i = 1;i <= n;i++){
 		for(int j = 1;j < i;j++){
 			if(abs(a[i]-a[j]) <= x*(i-j)) dp[i] = min(dp[i],dp[j]+i-j-1);
		}
	}
	for(int i = 1;i <= n;i++){
		if(dp[i]+n-i < k){
			return true;
		}
	}
	return false;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i = 1;i <= n;i++) scanf("%d",&a[i]);
 	int l = 0,r = 2000000000,mid,ans;
 	while(l <= r){
 		mid = (l+r) >> 1;
		if(check(mid)){
			r = mid-1;
			ans = mid;
		}else{
			l = mid+1;
		}
	}
	printf("%d\n",ans);
 	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int n,k,a[2010],dp[2010];
bool check(int x){
	for(int i = 1;i <= n;i++) dp[i] = i;
 	for(int i = 1;i <= n;i++){
 		for(int j = 1;j < i;j++){
 			if(abs(a[i]-a[j]) <= x*(i-j)) dp[i] = min(dp[j],i-j-1);
		}
	}
	for(int i = 1;i <= n;i++){
		if(dp[i]+n-i < k){
			return true;
		}
	}
	return false;
}
int main(){
	scanf("%d%d",&n,&k);
	for(int i = 1;i <= n;i++) scanf("%d",&a[i]);
 	int l = 0,r = 20000000000,mid,ans;
 	while(l <= r){
 		mid = (l+r) >> 1;
		if(check(mid)){
			r = mid-1;
			ans = mid;
		}else{
			l = mid+1;
		}
	}
	printf("%d\n",ans);
 	return 0;
}


#include<bits/stdc++.h>
#define N 500005
#define int long long
using namespace std;
int n,K,a[N],dp[N];
inline bool check(int x){
	dp[1]=0;
	for (int i=2;i<=n;i++){
		dp[i]=i-1;
		for (int j=1;j<i;j++)
			if (abs(a[i]-a[j])<=x*(i-j)) dp[i]=min(dp[i],dp[j]+(i-j-1));
		if (dp[i]+n-i<=K) return 1;
	}
	return 0;
}
signed main(){
	scanf("%lld%lld",&n,&K);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	int l=0;int r=2e9;
	while (l+1<r){
		int mid=(l+r)>>1;
		if (check(mid)) r=mid;
		else l=mid;
	}
	if (check(l)) printf("%lld\n",l);else printf("%lld\n",r);
	return 0;
}


#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,K,a[N],dp[N];
inline bool check(int x){
	memset(dp,127,sizeof(dp));dp[1]=0;
	for (int i=2;i<=n;i++){
		for (int j=1;j<i;j++)
			if (abs(a[i]-a[j])<=x*(i-j)) dp[i]=min(dp[i],dp[j]+(i-j-1));
		if (dp[i]+n-i<=K) return 1;
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&K);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int l=0;int r=2e9;
	while (l+1<r){
		int mid=(l+r)>>1;
		if (check(mid)) r=mid
		;else l=mid;
	}
	if (check(l)) printf("%d\n",l);else printf("%d\n",r);
	return 0;
}


#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,K,a[N],dp[N];
inline bool check(int x){
	dp[1]=0;
	for (int i=2;i<=n;i++){
		dp[i]=i-1;
		for (int j=1;j<i;j++) if (abs(a[i]-a[j])<=x*(i-j)) dp[i]=min(dp[i],dp[j]+(i-j-1));
		if (dp[i]+n-i<=K) return 1;
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&K);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int l=0;int r=2e9;
	while (l+1<r){
		int mid=(l+r)>>1;
		if (check(mid)) r=mid
		;else l=mid;
	}
	if (check(l)) printf("%d\n",l);else printf("%d\n",r);
	return 0;
}


#include<bits/stdc++.h>
#define N 500005
using namespace std;
int n,K,a[N],dp[N];
inline bool check(int x){
	memset(dp,127,sizeof(dp));dp[1]=0;
	for (int i=2;i<=n;i++){
		dp[i]=i-1;
		for (int j=1;j<i;j++)
			if (abs(a[i]-a[j])<=x*(i-j)) dp[i]=min(dp[i],dp[j]+(i-j-1));
		if (dp[i]+n-i<=K) return 1;
	}
	return 0;
}
int main(){
	scanf("%d%d",&n,&K);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int l=0;int r=2e9;
	while (l+1<r){
		int mid=(l+r)>>1;
		if (check(mid)) r=mid
		;else l=mid;
	}
	if (check(l)) printf("%d\n",l);else printf("%d\n",r);
	return 0;
}


#include<bits/stdc++.h>
#define N 500005
#define int long long
using namespace std;
int n,K,a[N],dp[N];
inline bool check(int x){
	dp[1]=0;
	for (int i=2;i<=n;i++){
		dp[i]=i-1;
		for (int j=1;j<i;j++) if (abs(a[i]-a[j])<=x*(i-j)) dp[i]=min(dp[i],dp[j]+(i-j-1));
		if (dp[i]+n-i<=K) return 1;
	}return dp[n]<=K;
}
signed main(){
	scanf("%lld%lld",&n,&K);
	for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
	int l=0, r=2e9;
	while (l+1<r){
		int mid=(l+r)>>1;
		if (check(mid)) r=mid;
		else l=mid;
	}
	if (check(l)) printf("%lld\n",l);
	else printf("%lld\n",r);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<cstring>
#include<queue>
#include<cmath>
#include<map>
#include<algorithm>
#define ll long long
using namespace std;
int n,k;
int dp[2005];//dp[i]表示第i个不改，前面符合条件的最小改动次数;
int a[2005],maxn=0;
inline bool check(long long x)
{
	dp[1]=0;
	for(register int i=2;i<=n+1;i++)
	{
		dp[i]=i-1;
		for(register int j=1;j<i;j++)
		{
			if(i==n+1) dp[i]=min(dp[i],dp[j]+(i-j-1));
			if(abs(a[j]-a[i])<=x*(i-j))
			{
				dp[i]=min(dp[i],dp[j]+(i-j-1));
			}
		}
	}
	return dp[n+1]<=k;
}
int main()
{
//	freopen("number.in","r",stdin);
//	freopen("number.out","w",stdout);
	scanf("%d%d",&n,&k);
	for(register int i=1;i<=n;i++) scanf("%d",&a[i]),maxn=max(maxn,abs(a[i]-a[i-1]));
	int l=0,r=maxn,mid,ans;
	while(l<=r)
	{
	    mid=(l+r)>>1;
		if(check(mid))
		{
			r=mid-1;
			ans=mid;
		}
		else l=mid+1;
	}
	printf("%d",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#define ll long long
using namespace std;
ll l=0,r=1e15;
ll a[12345];
int n,k,dp[12345];
bool check(ll p){
for(int i=1;i<=n;i++)dp[i]=i-1;
for(int i=2;i<=n;i++){
for(int r=1;r<i;r++){
	if(1ll*abs(a[i]-a[r])<=1ll*(i-r)*p)dp[i]=min(dp[i],dp[r]+(i-r-1));
}
}
int res=n;
for(int i=1;i<=n;i++)res=min(res,dp[i]+(n-i));
//cout<<"check:"<<p<<" "<<dp[n]<<endl;
return res<=k;
}

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)scanf("%lld",a+i);
	ll ans=1e15;
	while(l<=r){
		int mid=(l+r)>>1;
//		cout<<"solve:"<<l<<" "<<r<<" "<<mid<<endl;
		if(check(mid))ans=mid,r=mid-1;
		else l=mid+1;
	}
	printf("%lld\n",ans);
}


#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
long long a;
long long b;
long long c[2001],y[2001],ans;
int main()
{
	scanf("%lld%lld",&a,&b);
	for(int i=1;i<=a;i++)
	{
		scanf("%lld",&c[i]);
	}
	long long l=0,r=100000000000;
	while(l<=r)
	{
		long long mid=(l+r)/2;
		memset(y,0,sizeof(y));
		for(int i=1;i<=a;i++)
		{
			for(int j=1;j<i;j++)
			{
				if(c[i]-c[j]>=(i-j)*mid)
				{
					y[i]=max(y[i],y[j]+1);
				}
			}
			if(y[i]+b>=a)
			{
				ans=mid;
				l=mid+1;
				break;
			}
		}
		if(l!=mid+1) r=mid-1;
	}
	printf("%lld",ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#define maxn 1005
#define INF (1ll<<50)
#define LL long long

using namespace std;

int n,k;
LL a[maxn];
LL memo[maxn][maxn];
LL ans=INF;

void dfs(int id,int kx,LL val,int lst){
	if(id>n) return;
	if(memo[id][kx]<=val) return;
	else memo[id][kx]=val;

	for(int i=1;i<=k-kx;i++){
		if(i+id+1>n+1)break;
		LL r=a[i+id+1],l=a[id];
		if(id==0) l=r;
		else if(id+i+1==n+1) r=l;
		else l=a[id];
		LL num=(r-l)/(i+1)+((r-l)%(i+1)?1:0);
		dfs(id+i,kx+i,max(val,num),a[id+1]-num);
	}
	dfs(id+1,kx,max(val,abs(a[id]-lst)),a[id]);
}
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++) cin>>a[i];
    a[n+1]=a[n]; a[0]=a[1];
    if(k==1){
    	LL maxx=-1,id=-1;
    	for(int i=2;i<=n;i++){
    		if(a[i]-a[i-1]>maxx){
    			maxx=a[i]-a[i-1];
    			id=i;
    		}
    	}
		maxx=-1;
    	LL temp=a[id];

    	a[id]=(id==n?a[id-1]:(a[id-1]+a[id+1])/2);

    	for(int i=2;i<=n;i++)
    		if(a[i]-a[i-1]>maxx)
    			maxx=a[i]-a[i-1];
    	ans=maxx;
    	a[id]=temp;
		a[id-1]=(id==2?a[id]:(a[id-2]+a[id])/2);
    	maxx=-1;
    	for(int i=2;i<=n;i++)
    		if(a[i]-a[i-1]>maxx)
    			maxx=a[i]-a[i-1];

    	ans=min(ans,maxx);
    	cout<<ans;
    }
    else{
    	for(int i=0;i<=n+5;i++)
    	for(int j=0;j<=k+5;j++)
    		memo[i][j]=INF;
    	dfs(0,0,0,a[1]);
    	for(int i=0;i<=k;i++)
    		ans=min(ans,memo[n][i]);

    	cout<<ans;
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int N = 3000;

int n, k;
int a[N], f[N];

bool check(int x)
{
	f[1] = 1;
	for (int i=2;i<=n;++i)
	{
		f[i] = 1;
		for (int j=1;j<i;++j)
		    if (abs(a[i]-a[j]) <= (i-j)*x)
		        f[i] = max(f[j]+1,f[i]);
	}
	return f[n] >= n-k;
}

int main(void)
{
	scanf("%d %d", &n, &k);
	for (int i=1;i<=n;++i)
		scanf("%d", a+i);
	int l = 0, r = 1e9, mid;
	while (l+1 < r)
	{
		mid = l+r >> 1;
		check(mid) ? r = mid : l = mid;
	}
	printf("%d\n", check(l) ? l : r);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
char s[1010100];
queue < int > pe;
queue < int > fo;
int mij[1010100];
char ss[1010100];
int maxw=0;
bool check(int x){
	for (int i=1;i<=n;i++) ss[i] = s[i];
    maxw=0;
    for (int i=1;i<=n;i++){
	    if (ss[i] == 'P') {maxw=max(maxw,i+x);continue;}
	    if (ss[i] == '.') continue;
	    if (i<=maxw) continue;
	    int d=mij[i]-i;
	    if (d > x) return 0;
	    if (3*d <= x)
	      if (maxw < (mij[i]+x-d-d)) maxw = mij[i]+x-d-d;else;
	    else
	      if (maxw < mij[i]+(x-d)/2) maxw = mij[i]+(x-d)/2;else;
	    ss[mij[i]] = '.';
	}
	return 1;
}

int main(){
    cin>>n>>s+1;
    for (int i=1;i<=n;i++)
      if (s[i] == '*') fo.push(i);
      else if (s[i] == 'P') pe.push(i);
    int now = pe.front();pe.pop();
	while (!fo.empty()){
		int Fo = fo.front();fo.pop();
	    while (now < Fo) now=pe.front(),pe.pop();
	    mij[Fo] = now;
	}
//	for (int i=1;i<=n;i++) cout<<mij[i]<<' ';
//	cout<<endl;
	int l=0,r=1e9;
	while(l+1<r){
	    int mid = l+r>>1;
//	    cout<<l<<' '<<r<<endl;
	    if (check(mid)) r=mid;
	    else l = mid;
	}
	printf("%d",check(l)?l:r);
	return 0;
}


#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

typedef long long LL;
const int MAXN = 2e3 + 5;

LL a[MAXN], dp[MAXN], n, m;

bool check(LL x) {
	for(int i = 2; i <= n; ++i) {
		dp[i] = 1e9;
	}
	for(int i = 1; i <= n; ++i) {
		for(int j = 1; j < i; ++j) {
			if(abs(a[i] - a[j]) <= (i - j) * x) {
				dp[i] = min(dp[i], dp[j] + i - j - 1);
			}
		}
	}
	for(int i = 1; i <= n; ++i) {
		if(dp[i] + n - i <= m) {
			return true;
		}
	}
	return false;
}

LL BS(LL l, LL r) {
	while(l < r) {
		LL mid = (l + r) >> 1;
		if(check(mid)) {
			r = mid;
		} else {
			l = mid + 1;
		}
	}
	return l;
}

int main() {
	LL MIN = 2e9, MAX = -2e9;
	scanf("%lld %lld", &n, &m);
	for(int i = 1; i <= n; ++i) {
		scanf("%lld", &a[i]);
		MAX = max(MAX, a[i]);
		MIN = min(MIN, a[i]);
	}
	printf("%lld\n", BS(0, MAX - MIN));
	return 0;
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#define il inline
#define re register
using namespace std;
typedef long long ll;
const ll maxn = 2010;
const ll maxa = 1e9 + 10;
ll n, k, l, r, mid;
ll f[maxn], a[maxn];
il bool check(ll up) {
	for(re ll i = 0; i < n; ++i) f[i] = i;
	//最大的差值不能大于up
	//f[i]表示i不变,其他需要改变的个数
	for(re ll i = 0; i < n; ++i) {
		for(re ll j = i + 1; j < n; ++j) {
			//j不改
			if(abs(a[i]-a[j]) <= up*(j-i))
				f[j] = min(f[j], f[i]+(j-i-1));
		}
	}
	for(re ll i = 0; i < n; ++i) {
		if(f[i] + (n-i-1) <= k) return true;
	}
	return false ;
}
int main() {
	scanf("%I64d%I64d", &n, &k);
	for(re ll i = 0; i < n; ++i)
		scanf("%I64d", &a[i]);
	/*for(re ll i = 1; i <= n; ++i)
		printf("%I64d\n", a[i]);*/
	l = 0; r = maxa;
	while(l <= r) {//二分答案
		mid = (l + r) >> 1;
		if(check(mid))
			r = mid-1;
		else l = mid+1;
	}
	printf("%I64d\n", mid);
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n,k,l,r,a[2010],f[2010];
bool check(ll mid){
	for(register int i=0;i<n;++i)f[i]=i;
	for(register int i=0;i<n;++i)
	for(register int j=i+1;j<n;++j)
	if(abs(a[i]-a[j])<=mid*(j-i))f[j]=min(f[j],f[i]+j-i-1);
	for(register int i=0;i<n;++i)if(f[i]+n-i-1<=k)return 0;
	return 1;
}
int main(){
	scanf("%d%d",&n,&k);
	for(register int i=0;i<n;++i)scanf("%d",a+i);
	r=2000000000;
	while(l<r){
		ll mid=l+r>>1;
		if(check(mid))l=mid;
		else r=mid-1;
	}
	printf("%d",l);
	return 0;
}


#include<cstring>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<iostream>
using namespace std;
typedef long long ll;
const int maxm=2005;
ll a[maxm];
ll l,r,ans;
int dp[maxm];
int n,k;
bool check(ll x)
{
	int c=0;
   for(int i=1;i<=n;i++)
   dp[i]=1;
   for(int i=1;i<=n;i++)
   {
   	 for(int j=1;j<i;j++)
   	 if(abs(a[i]-a[j])<=x*(i-j))
   	 dp[i]=max(dp[i],dp[j]+1);
   }
   for(int i=1;i<=n;i++)
   {
   	c=max(dp[i],c);
   }
   if(n-c>k) return 0;
   else return 1;
}
int main()
{
 scanf("%d%d",&n,&k);
 for(int i=1;i<=n;i++)
 scanf("%lld",a+i);
 l=0,r=2e9+1;
 while(l<=r)
 {
    ll mid=(l+r)>>1;
	if(check(mid))
    {
	  ans=mid;
	  r=mid-1;
    }
    else l=mid+1;
 }
 printf("%lld\n",ans);

 return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
long long n,m,u,v,mid,s[10000],dp[10000],ans;
signed main(){
	scanf("%lld%lld",&n,&m);
	for(int i = 1; i <= n; i++) scanf("%lld",&s[i]);
	u=0,v=1e9;
	while(u<v){
		mid=(u+v)/2,ans=1e9;
		for(int i = 1; i <= n; i++){
			dp[i]=i-1;
			for(int j = i-1; j >= 1; j--)
				if(abs(s[j]-s[i])<=mid*(i-j))
					dp[i]=min(dp[i],i-j-1+dp[j]);
			ans=min(ans,dp[i]+n-i);
		}
		if(ans>m) u=mid+1;
		else v=mid;
	}
	printf("%lld",u);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a[2005];
long long dp[2005];
long long n,m;
bool check(long long x)
{
    for(long long i=1;i<=n;i++)
    {
        dp[i]=i-1;
    }
    for(long long i=2;i<=n;i++)
    {
        for(long long j=1;j<i;j++)
        {
            if(abs(a[i]-a[j])<=x*(i-j))
            {
                dp[i]=min(dp[i],dp[j]+i-j-1);
            }
        }
    }
    if(dp[n]<=m) return 1;
    return 0;
}
int main()
{
    scanf("%lld%lld",&n,&m);
    for(long long i=1;i<=n;i++)
    {
        scanf("%lld",&a[i]);
    }
    long long l=0,r=0x7f7f7f7f,mid,ans=0;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }
    }
    printf("%lld",ans);
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
char s[1010100];
queue < int > pe;
queue < int > fo;
int mij[1010100];
int maxw=0;
bool check(int x){
	char ss[1010100];
	for (int i=1;i<=n;i++) ss[i] = s[i];
    maxw=0;
    for (int i=1;i<=n;i++){
	    if (ss[i] == 'P') {maxw=max(maxw,i+x);continue;}
	    if (ss[i] == '.') continue;
	    if (i<=maxw) continue;
	    int d=mij[i];
	    if (d > x || d > n) return 0;
	    if (3*d <= x)
	      if (maxw < (i+x-d-d)) maxw = i+mij[i]+x-d-d;else;
	    else
	      if (maxw < i+(x-d)/2) maxw = i+mij[i]+(x-d)/2;else;
	    ss[i+mij[i]] = '.';
	}
	return 1;
}

int main(){
    cin>>n>>s+1;
    for (int i=1;i<=n;i++)
      if (s[i] == '*') fo.push(i);
      else if (s[i] == 'P') pe.push(i);
    int now = pe.front();pe.pop();
	while (!fo.empty()){
		int Fo = fo.front();fo.pop();
	    while (now < Fo) now=pe.front(),pe.pop();
	    mij[Fo] = now - Fo;
	}
//	for (int i=1;i<=n;i++) cout<<mij[i]<<' ';
//	cout<<endl;
	int l=0,r=1e9;
	while(l+1<r){
	    int mid = l+r>>1;
//	    cout<<l<<' '<<r<<endl;
	    if (check(mid)) r=mid;
	    else l = mid;
	}
	printf("%d",check(l)?l:r);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int a[2333];
int dp[2333];
int n,k;
bool check(long long x){
    for(int i=0;i<n;i++)dp[i]=i;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])<=(j-i)*x){
				dp[j]=min(dp[j],dp[i]+j-i-1);
			}
		}
	}
	for(int i=0;i<n;i++){
        if(dp[i]+n-i-1<=k)return true;
    }
    return false;
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    int l,r,mid;
    l=0;
    r=23333333;
    while(l<=r){
        mid=(l+r)>>1;
        if(check(mid))r=mid-1;
        else l=mid+1;
    }
    cout<<l<<endl;
    return 0;
}


#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<stack>
#include<cstring>
#define ll long long
#define inf 1ll<<50
using namespace std;
int n,k;
ll a[1005];
ll memo[1005][1005];
void dfs(int sdt,int usd,ll hl,int lst){
	if(sdt>n)return;
//	cout<<sdt<<" "<<usd<<" "<<hl<<endl;
	if(memo[sdt][usd]<=hl)return;
	else memo[sdt][usd]=hl;
	dfs(sdt+1,usd,max(hl,abs(a[sdt]-lst)),a[sdt]);
	int p=sdt+1;
	for(int i=1;i<=k-usd;i++){
		if(i+p>n+1)break;
		ll r=a[p+i],l=a[p-1];
		if(p==1)l=r;
		else if(p+i==n+1)r=l;
		else l=a[p-1];
		ll num=(r-l)/(i+1);
		//cout<<"?"<<p<<" "<<sdt+i<<" "<<l<<" "<<r<<" "<<num<<" "<<max(hl,num)<<" "<<usd+i<<endl;
		if((r-l)%(i+1)>0)num++;
		dfs(p+i-1,usd+i,max(hl,num),a[p]-num);
	}
}
ll ans=inf;
int main(){
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++){
    	scanf("%lld",&a[i]);
    }
    a[n+1]=a[n];
    a[0]=a[1];
    if(k==1){
    	ll maxx=-1,maxp=-1;
    	for(int i=2;i<=n;i++){
    		if(a[i]-a[i-1]>maxx){
    			maxx=a[i]-a[i-1];
    			maxp=i;
    		}
    	}
    	ll rem=a[maxp];
    	if(maxp==n)a[maxp]=a[maxp-1];
    	else a[maxp]=(a[maxp-1]+a[maxp+1])/2;
    	maxx=-1;
    	for(int i=2;i<=n;i++){
    		if(a[i]-a[i-1]>maxx){
    			maxx=a[i]-a[i-1];
    		}
    	}
    	ans=maxx;
    	a[maxp]=rem;
    	if(maxp-1==1)a[maxp-1]=a[maxp];
    	else a[maxp-1]=(a[maxp-2]+a[maxp])/2;
    	maxx=-1;
    	for(int i=2;i<=n;i++){
    		if(a[i]-a[i-1]>maxx){
    			maxx=a[i]-a[i-1];
    		}
    	}
    	ans=min(ans,maxx);
    	printf("%lld",ans);
    }
    else{
    	for(int i=0;i<=n+3;i++){
    		for(int j=0;j<=k+3;j++){
    			memo[i][j]=inf;
    		}
    	}
    	dfs(0,0,0,a[1]);
    	for(int i=0;i<=k;i++){
    		ans=min(ans,memo[n][i]);
    	}
    	printf("%lld",ans);
    }
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int a[2005];
int dp[2005];
int n,m;
bool check(int x)
{
    for(int i=1;i<=n;i++)
    {
        dp[i]=i-1;
    }
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<i;j++)
        {
            if(abs(a[i]-a[j])<=x*(i-j))
            {
                dp[i]=min(dp[i],dp[j]+i-j-1);
            }
        }
    }
    if(dp[n]<=m) return 1;
    return 0;
}
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    int l=0,r=0x7f7f7f7f,mid,ans=0;
    while(l<=r)
    {
        mid=(l+r)>>1;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
        {
            l=mid+1;
        }
    }
    printf("%d",ans);
    return 0;
}


#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#define il inline
#define re register
using namespace std;
typedef long long ll;
const ll maxn = 2010;
const ll maxa = 2000000000;
ll n, k, l, r, mid;
ll f[maxn], a[maxn];
il bool check(ll up) {
	for(re ll i = 1; i <= n; ++i) f[i] = i;
	//最大的差值不能大于up
	//f[i]表示i不变,其他需要改变的个数
	for(re ll i = 1; i <= n; ++i) {
		for(re ll j = i + 1; j <= n; ++j) {
			//j不改
			if(abs(a[i]-a[j]) <= up*(j-i))
				f[j] = min(f[j], f[i]+(j-i-1));
		}
	}
	for(re ll i = 1; i <= n; ++i) {
		if(f[i] + (n-i-1) <= k) return true;
	}
	return false ;
}
int main() {
	scanf("%I64d%I64d", &n, &k);
	for(re ll i = 1; i <= n; ++i) {
		scanf("%I64d", &a[i]);
		r = max(r, abs(a[i]));
	}
	/*for(re ll i = 1; i <= n; ++i)
		printf("%I64d\n", a[i]);*/
	l = 0;
	while(l <= r) {//二分答案
		mid = (l + r) >> 1;
		if(check(mid))
			r = mid-1;
		else l = mid+1;
	}
	printf("%I64d\n", l);
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
int a[2333],dp[2333],n,k;
bool check(long long x){
    for(int i=0;i<n;i++)dp[i]=i;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(abs(a[i]-a[j])<=(j-i)*x){
				dp[j]=min(dp[j],dp[i]+j-i-1);
			}
		}
	}
	for(int i=0;i<n;i++){
        if(dp[i]+n-i-1<=k)return true;
    }
    return false;
}
int main(){
    scanf("%d%d",&n,&k);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    long long l=0,r=12333333333,mid;
    while(l<=r){
        mid=(l+r)>>1;
        if(check(mid))r=mid-1;
        else l=mid+1;
    }
    cout<<l<<endl;
    return 0;
}


#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rof(i,a,b) for(int i=(a);i>=(b);--i)
#define LL long long
using namespace std;
int N,K;LL F[2001],A[2001];
bool Check(int Pos){
	LL Max=1;memset(F,0,sizeof(F));F[1]=1;
	For(i,2,N)For(j,1,i-1)
		if(1ll*abs(A[i]-A[j])<=1ll*Pos*(i-j)) F[i]=max(F[i],F[j]+1),Max=max(Max,F[i]);
	return ((1ll*Max+1ll*K)>=1ll*N);
}
int main(){
	scanf("%d%d",&N,&K);
	For(i,1,N) scanf("%I64d",&A[i]);
	LL l=0,r=2000000000,Ans,Mid;
	while(l<=r){
		Mid=l+r>>1;
		if(Check(Mid))
			Ans=Mid,r=Mid-1;
		else
			l=Mid+1;
	}
	printf("%I64d\n",Ans);
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#define rr register int
using namespace std;
typedef long long ll;
inline ll read(){
    char i=getchar();
    ll f=1,res=0;
    while(i<'0'||i>'9'){if(i=='-')f=-1;i=getchar();}
    while(i>='0'&&i<='9'){res=res*10+i-'0';i=getchar();}
    return res*f;
}
const int N=2050;
int a[N],dp[N],n,k;
inline bool pd(ll mid){
//令 dp[i]表示到当前位置且当前位置不修改的最小次数
	dp[1]=0;
	for(rr i=2;i<=n+1;++i){
		dp[i]=i-1;
		for(rr j=i-1;j>0;--j){
			if(i>n)dp[i]=min(dp[i],dp[j]+i-j-1);
			if(abs(a[i]-a[j])<=abs(mid*ll(i-j)))dp[i]=min(dp[i],dp[j]+i-j-1);
		}
	}
	return dp[n+1]<=k;
}
int main(){
	freopen("number.in","r",stdin);
	freopen("number.out","w",stdout);
    n=read(),k=read();
    for(rr i=1;i<=n;++i) a[i]=read();
    ll l=0,r=2e9,mid,ans;
    while(l<=r){
//    	0001111 二分相邻两数差的绝对值
    	mid=(l+r)>>1;
    	if(pd(mid)){
    		r=mid-1;
    		ans=mid;
    	}else l=mid+1;
    }
    printf("%lld\n",ans);
}


#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
long long dp[2005],a[2005];
int n,m;

bool judge(long long k)
{
	dp[1]=0;
	for(int i=2;i<=n;++i)
	{
		dp[i]=i-1;
		for(int j=1;j<i;++j)
		{
			if(abs(a[j]-a[i])<=k*(i-j))
			dp[i]=min(dp[i],dp[j]+i-j-1);
		}
	}
	if(dp[n]<=m) return 1;
	return 0;
}

int main()
{
	while(scanf("%d %d",&n,&m)!=EOF)
	{
		for(int i=1;i<=n;++i) scanf("%d",&a[i]);
		int l=0,r=2e9;
		while(l<=r)
		{
			int mid=(l+r)>>1;
			if(judge(mid)) r=mid-1;
			else l=mid+1;
		}
		printf("%d\n",r+1);
	}
	return 0;
}


#include<cstdio>
#include<cstring>
#include<cmath>
#include<iostream>

const int inf = 0x3f3f3f3f;
typedef long long ll;
const int Maxn = 2005;
using namespace std;

int n,k;

ll a[Maxn];
ll dp[Maxn];

bool check(ll mid)
{
    memset(dp,inf,sizeof(dp));
    dp[1]=0;
    for(ll i=2;i<=n;i++){
        dp[i]=i-1;
        for(ll j=i-1;j>=1;j--){
            if(abs(a[i]-a[j])<=mid*(i-j))
                dp[i]=min(dp[i],dp[j]+i-j-1);
        }
        if(dp[i]+n-i<=k)return 1;
    }
    if(dp[n]<=k)
		return true;
    return false;
}

int main(){
	scanf("%d%d",&n,&k);
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	ll l=0,r=2e9,ans=0;
	while(l<=r){
		int mid=(l+r)>>1;
		if(check(mid)){
			r=mid-1;
			ans=mid;
		}
		else
			l=mid+1;
	}
	printf("%lld",ans);
}


#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<map>
#include<set>
#define ll long long
#define maxn 2007
using namespace std;

int n,k;
ll a[maxn];
ll ans=1e16+7;
ll dp[maxn];

bool ok(ll x)
{
//	cout<<x<<endl;
//	memset(dp,0,sizeof(dp));//前i个的最小差值，第i个不动
	for(int i=1;i<=n;i++)
	{
		dp[i]=i-1;
		for(int j=1;j<i;j++)
		{
			if(abs(a[i]-a[j])<=(i-j)*x)
			{
				dp[i]=min(dp[i],dp[j]+(i-j-1));
			}
		}
	}
	for(int i=1;i<=n;i++)
	{
		if(dp[i]+(n-i)<=k)
		{
//			cout<<dp[i]<<" "<<(n-i)<<"****"<<endl;
			return 1;
		}
	}
	return 0;
}

int main(){
	ios::sync_with_stdio(0);
//	freopen("chaos.in","r",stdin);
//	freopen("chaos.out","w",stdout);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	ll l=0,r=(1ll<<55);
	while(r-l>5)
	{
		ll mid=(l+r)/2;
		if(ok(mid)) r=mid;
		else l=mid;
	}
	for(int i=l;i<=r;i++)
	{
		if(ok(i))
		{
			cout<<i;
			return 0;
		}
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define int long long
#define MAXN 2005
#define PII pair <int, int>
int arr [MAXN];
int dp[MAXN][3 * MAXN];
map <int, int> i, c;
int bc [MAXN * 3];
int findc [MAXN];
main(){
    ios_base::sync_with_stdio(0);
    int n, k; cin >> n >> k;
    for (int g=1; g<=n; g++) cin >> arr[g];
    int lo = 0, hi = 2e9;
    while (hi > lo){
        int cnt = 1;
        int mid = (hi + lo)/2;
        c.clear();
        i.clear();
        memset(bc,0,sizeof(bc));
        for (int g=1; g<=n; g++) i[arr[g]] = 1, i[arr[g] + mid] = 1, i[arr[g] - mid] = 1;
        for (auto x = i.begin(); x!=i.end(); x++){
            bc[cnt] = x->first;
            c[x->first] = cnt++;
        }cnt--;
        memset(findc,0,sizeof(findc));
        for (int g=1; g<=n; g++) findc[g] = c[arr[g]];
        memset(dp, 0, sizeof(dp));
        for (int g=n; g>=1; g--){
            deque <PII> qu;
            int cur = 1;
            for (int y=1; y<=cnt; y++){
                while (cur<=cnt && bc[y]+mid>=bc[cur]){
                    int f = dp[g+1][cur];
                    while(qu.size() && qu.back().first>=f){
                        qu.pop_back();
                    }
                    qu.push_back(PII(f, cur));
                    cur++;
                }
                while (qu.size() && bc[qu[0].second]+mid < bc[y]){
                    qu.pop_front();
                }
                dp[g][y] = 1e15 + 5;
                if (abs(arr[g] - bc[y])<=mid){
                    dp[g][y] = dp[g+1][findc[g]];
                }
                if (qu.size()){
                    dp[g][y] = min(dp[g][y], 1 + qu[0].first);
                }
            }
        }
        int answer = 1e15;
        for (int g=1; g<=cnt; g++){
            if (dp[1][g] < answer) answer = dp[1][g];
        }
        if (answer > k){
            lo = mid + 1;
        }
        else hi = mid;
    }
    cout << lo;
    return 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define MAXN 2005
#define PII pair <int, int>
int arr [MAXN];
int dp[MAXN][3 * MAXN];
map <int, int> i;
unordered_map <int, int> c;
int bc [MAXN * 3];
int findc [MAXN];
main(){
    ios_base::sync_with_stdio(0);
    srand(time(0));
    int n=2000, k=rand()%1000;
    for (int g=1; g<=n; g++)arr[g]=((rand()%2)?(-1):(1))*rand()%(1000000000);
    int lo = 0, hi = 2e9;
    while (hi > lo){
        int cnt = 1;
        int mid = (hi + lo)/2;
        i.clear();
        for (int g=1; g<=n; g++) i[arr[g]] = 1, i[arr[g] + mid] = 1, i[arr[g] - mid] = 1;
        for (auto x = i.begin(); x!=i.end(); x++){
            bc[cnt] = x->first;
            c[x->first] = cnt++;
        }cnt--;
        for (int g=1; g<=n; g++) findc[g] = c[arr[g]];
        for (int g=n; g>=1; g--){
            vector <PII> qu;
            int cur = 1;
            int z=0;
            for (int y=1; y<=cnt; y++){
                while (cur<=cnt && bc[y]+mid>=bc[cur]){
                    int f = dp[g+1][cur];
                    while(qu.size() && qu.back().first>=f){
                        qu.pop_back();
                    }
                    qu.push_back(PII(f, cur));
                    cur++;
                }
                while (z<qu.size() && bc[qu[z].second]+mid < bc[y]){
                    z++;
                }
                dp[g][y] = 2e9+ 5;
                if (abs(arr[g] - bc[y])<=mid){
                    dp[g][y] = dp[g+1][findc[g]];
                }
                if (qu.size()>=z+1){
                    dp[g][y] = min(dp[g][y], 1 + qu[z].first);
                }
            }
        }
        int answer = 2e9;
        for (int g=1; g<=cnt; g++){
            if (dp[1][g] < answer) answer = dp[1][g];
        }
        if (answer > k){
            lo = mid + 1;
        }
        else hi = mid;
    }
    cout << lo;
    return 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define int long long
#define MAXN 2005
#define PII pair <int, int>
int arr [MAXN];
int dp[MAXN];
main(){
    ios_base::sync_with_stdio(0);
    int n,k;cin>>n>>k;
    if (n==k){
        cout<<0;
        return 0;
    }
    for (int g=1; g<=n; g++)cin>>arr[g];
    int lo = 0, hi = 2e9;
    int t = 0;
    while (hi > lo){
        int mid = (hi + lo) / 2;
        memset(dp, 0, sizeof(dp));
        for (int g=1; g<=n; g++){
            dp[g] = 2e9;
            for (int y = 1; y < g; y++){
                int diff = abs (arr[g] - arr[y]);
                if (mid * (g-y) >= diff){
                    dp[g] = min(dp[g], (g-y-1) + dp[y]);
                }
            }
            dp[g] = min(dp[g], g-1);
        }
        int answer = 2e9 + 1;
        for (int g=1; g<=n; g++){
            int t = n-g+dp[g];
            if (t < answer) answer = t;
        }
        if(answer<=k){
            hi = mid;
        }
        else lo = mid + 1;
    }
    cout << lo;
    return 0;
}


#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define int long long
#define MAXN 2005
#define PII pair <int, int>
int arr [MAXN];
int dp[MAXN][3 * MAXN];
map <int, int> i;
unordered_map <int, int> c;
int bc [MAXN * 3];
int findc [MAXN];
main(){
    ios_base::sync_with_stdio(0);
    int n, k; cin >> n >> k;
    for (int g=1; g<=n; g++) cin >> arr[g];
    int lo = 0, hi = 2e9;
    while (hi > lo){
        int cnt = 1;
        int mid = (hi + lo)/2;
        i.clear();
        for (int g=1; g<=n; g++) i[arr[g]] = 1;
        for (auto x = i.begin(); x!=i.end(); x++){
            bc[cnt] = x->first;
            c[x->first] = cnt++;
        }cnt--;
        for (int g=1; g<=n; g++) findc[g] = c[arr[g]];
        for (int g=n; g>=1; g--){
            deque <PII> qu;
            int cur = 1;
            for (int y=1; y<=cnt; y++){
                while (cur<=cnt && bc[y]+mid>=bc[cur]){
                    int f = dp[g+1][cur];
                    while(qu.size() && qu.back().first>=f){
                        qu.pop_back();
                    }
                    qu.push_back(PII(f, cur));
                    cur++;
                }
                while (qu.size() && bc[qu[0].second]+mid < bc[y]){
                    qu.pop_front();
                }
                dp[g][y] = 1e15 + 5;
                if (abs(arr[g] - bc[y])<=mid){
                    dp[g][y] = dp[g+1][findc[g]];
                }
                if (qu.size()){
                    dp[g][y] = min(dp[g][y], 1 + qu[0].first);
                }
            }
        }
        int answer = 1e15;
        for (int g=1; g<=cnt; g++){
            if (dp[1][g] < answer) answer = dp[1][g];
        }
        if (answer > k){
            lo = mid + 1;
        }
        else hi = mid;
    }
    cout << lo;
    return 0;
}