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

typedef unsigned long long  ULL;
typedef long long LL;

#define pb push_back
#define mp make_pair
#define reset(a, b) memset(a, b, sizeof(a))
#define rep(i,b) for(int i=0; i<b; i++)
#define F first 
#define S second

 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    int T;
//    cin>>T;
    T=1;
    while(T--){
       
       int n,m;
       cin>>n>>m;
       int x;
       int sum=0;
       rep(i,m){
           cin>>x;
           sum+=x;
       }
       
       if(sum<=n) cout<<(n-sum);
       else cout<<-1;
    }
    
    return 0;
}