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

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

ll x;
map<ll, ll> sv;

ll f(ll y){
	if (sv.find(y) != sv.end()) return sv.find(y)->second;
	sv[y] = 0LL;
	ll &ans = sv[y];
	if (y>x){
		if (y&1){
			ll ri = y+1LL;
			ll le = y-1LL;
			return ans = min(f(ri)+1LL, f(le)+1LL);
		}else{
			ll ab = y-x;
			ll divi = y/2;
			return ans = min(f(x) + ab, f(divi) + 1);
		}
	}else if (y<x){
		return ans = x-y + f(x);
	}else return ans = 0LL;
}

void solve(){
	ll y; cin >> x >> y;
	cout << f(y) << '\n';
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int t = 1; //cin >> t;
	while(t--) solve();

	return 0;
}
// NK

#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
#define INF 1000000007
using namespace std;
int a,b,k,m,n,cnt=0,aa[110000];
string s,t;
char c;
signed main()
{
	cin>>n>>k>>m;
	rep(i,n-1){
		cin>>aa[i];
		cnt+=aa[i];
	}
	if(n*m-cnt>k){
		cout<<-1;
	}elif(n*m-cnt<0){
		cout<<0;
	}else{
		cout<<n*m-cnt;
	}
}