#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;

bool solve(int X, int M, vector<int>ss) {
	if (1 + X <= ss[0]) {
		return true;
	}
	 {

		int now_enemy=0;
		int now_level=1;

		for (int i = 0; i < M-1; ++i) {
			if(now_level+X>ss.back())return false;
			while (true) {
				if (now_level + X > ss[now_enemy + 1]) {
					int now_exp=max(1,X-abs(now_level-ss[now_enemy]));
					int next_exp=max(1,X-abs(now_level-ss[now_enemy+1]));

					if (now_exp <= next_exp) {
						now_enemy++;
					}
					else {
						break;
					}
				}
				else {
					break;
				}
			}

			now_level+=max(1,X-abs(now_level-ss[now_enemy]));
		}
		return true;
	}
}

int main()
{
	while (true) {
		int N,M;cin>>N>>M;
		if(!N)break;
		vector<int>ss(N);
		for(int i=0;i<N;++i)cin>>ss[i];

		int amin=-1;
		int amax=1e9;

		while (amin + 1 != amax) {
			int amid=(amin+amax+1)/2;

			if (solve(amid, M, ss)) {
				amin=amid;
			}
			else {
				amax=amid;
			}
		}
		if (amin == 0) {
			cout<<-1<<endl;
		}
		else if (amin + 1 <= ss[0]) {
			cout<<-1<<endl;
		}
		else {
			cout << amin << endl;

		}
	}
	return 0;
}

