#include <bits/stdc++.h>
using namespace std;
int main(){
    long int n, m;
    cin >> n >> m;
    long long int a[m], sum = 0;
    for(int i = 0 ; i < m ; i++){
    	cin>>a[i];
    	sum += a[i];
    }
    if(n-sum >=0 )cout<<n-sum<<"\n";
    else cout<<-1<<"\n";
}