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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, m;
    cin >> n >> m;
    vector<ll> v(m);
    ll sum = 0;
    for(int i = 0; i < m; i++){
        cin >> v[i];
        sum += v[i];
    }
   // cout << sum << endl;
    if(sum <= n){
        cout << n - sum << endl;
    }
    else{
        cout << "-1" << endl;
    }
    return 0;
}
