#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <algorithm>
#include <set>
#include <queue>

using namespace std;
#define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("aa_input.txt", "r", stdin);
    int t=1;
    //cin>>t;
    while (t--)
    {
       int n, m;
       cin>>n>>m;
       int a;
       int ans = 0;
       for(int i=0; i<m; i++){
           
           cin>>a;
           ans += a;
       }
       if(a>n) cout<<-1<<endl;
       else cout<<n-ans<<endl;
    }
    
    
    return 0;
}
/*

riaadmorshed@gmail.com

*/