#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds; 
using namespace std;
#define int long long
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mll map<ll,ll>
#define mii map<int,int>
#define mp make_pair
#define pb push_back
#define rep(i,b) for(ll (i)=0;i<(b);i++)
#define all(c) (c).begin(), (c).end()
#define F first
#define S second
#define CLR(p) memset(p, 0, sizeof(p))
#define SET(p) memset(p, -1, sizeof(p))
#define DEBUG true
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);
//typedef long long int ll;
typedef tree<int, null_type, less<int>, rb_tree_tag, 
tree_order_statistics_node_update> new_data_set; 
const int MAX=1e6+5;
#define MOD 1000000007
/*std::cout << std::fixed;
std::cout << std::setprecision(6);*/
//(a%mod-b%mod+mod)%mod

// #define LOCAL 1

/************************************


 
*************************************/

vector<int>par,dep,tin,tout;
vector<vector<int>>v;
vector<int>deg;
vector<pll>req;
bool visited[MAX];






void solve(){
    int t=1;
    // cin>>t;
    while(t--){
        int n,m;
        cin>>n>>m;
        int a[m];
        int sum=0;
        for(int i=0;i<m;i++){
            cin>>a[i];
            sum+=a[i];
        }
        if(sum>n){
            cout<<-1<<endl;
        }
        else{
            cout<<n-sum<<endl;
        }
        

        
    }
}


signed main() 
{ 
    boost;

    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    while (cin.peek() != EOF) {
        solve();
        cout << endl << endl;
        string s;
        do getline(cin, s);
        while (!cin.eof() && !s.empty());
        while (isspace(cin.peek())) cin.get();
    }
    #else
        solve();
    #endif




    

    
	return 0; 
} 