#include<iostream>
#include<string>
using namespace std;
    
int main(){
    int n,m;
    cin>>n;
    cin>>m;
    int a[m];
    int sum =0;
    for(int i=0;i<m;i++){
        cin>>a[i];
        sum+=a[i]; 
    }
    if(n-sum>=0)
    {
        cout<<n-sum;
    }else{
        cout<<-1;
    }
}