#include <bits/stdc++.h>
#include<algorithm>
#define int long long
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)


#define INF 1000000000000


signed main()
 {
   int n,m;
   cin>>m>>n;
   int nissuu=0;
   rep(i,n){
     int k;
     cin>>k;
     nissuu+=k;
   }
   if(m>=nissuu){
cout<<m-nissuu;
}
else cout<<"-1";
 }
