#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=2e6+5;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	ll n,m;cin >> n >> m;
	vector <int> a(n);
	int sum=0;
	rep(i,n){
		cin >> a[i];
		sum+=a[i];
	}
	if(sum>m)cout<<-1<<endl;
	else cout<<m-sum
}
	
