#include "bits/stdc++.h"

using namespace std;

int N,M,K,L,R,H,W;
//long long int N,M,K,L,R,H,W;

//const long long int MOD=1000000007;
const int MOD=1000000007;
//const long long int MOD=998244353;


int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N,M;
	while(cin>>N>>M,N){
		vector<int>v(N);
		for(auto &i:v)cin>>i;
		sort(v.begin(),v.end());
		v.push_back(MOD);
		int L=v[0]-1;
		int R=v[N-1];
		while(R-L>1){
			//cout<<L<<" "<<R<<endl;
			int mid=(L+R)/2;
			int cnt=0;
			int index=0;
			int st=0;
			int level=1;
			//cout<<"mid "<<mid<<endl;
			while(index<N){
				while(v[index]<level+mid)index++;
				while(v[st]<level)st++;
				int add=0;
				if(index>st)add=max(add,max(1,mid-abs(v[st]-level)));
				if(st)add=max(add,max(1,mid-abs(v[st-1]-level)));
				//cout<<add<<endl;
				level+=add;
				cnt++;
				//cout<<cnt<<" "<<level<<endl;
			}
			if(cnt<M)R=mid;
			else L=mid;
		}
		if(L==v[0]-1)cout<<-1<<endl;
		else cout<<L<<endl;
	}
	
	return 0;
}
