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

int main()
{
    int n,m;
    vector<int> a(m);
    cin >> n >> m;
    rep(i,m) {
        cin >> a[i];
    }
    int sum_cost;
    sum_cost = accumulate(a.begin(), a.end(), 0);
    if (n < sum_cost) {
        cout << "-1" << endl;
    } else {
        cout << n - sum_cost << endl;
    }

    return 0;
}