#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define nl '\n'
#define pi 2.0*acos(0.0)
#define mod maxm+7
#define FOR(i,j,n)    for(ll i=j;i<n;i++)
#define RFOR(i,j,n)    for(ll i=j;i>=n;i--)
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;

int main(){
    ll m,n,sum = 0;
    cin>>m>>n;
    ll arr[n];
    FOR(i,0,n) cin>>arr[i] , sum += arr[i];
    ll ans = m - sum;
    if(ans < 0) cout<< - 1 <<nl;
    else cout<< ans <<nl;
}
