#include<bits/stdc++.h>
#define ll long long
const int N=1000005;
using namespace std;
int n,m,a[N],ans;
int main(){
	cin>>m>>n;
	for(int i=1;i<=n;i++)
	    cin>>a[i],ans+=a[i];
	if(ans<=m) cout<<m-ans;
	else cout<<-1;
    return 0;
}