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

int main(){

int a,b,c;
int sum=0;
cin>>a>>c;

while(c--){
    cin>>b;
    sum+=b;
}
if(sum>a)
    cout<<"-1"<<endl;
else
    cout<<a-sum<<endl;


return 0;
}
