#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> arr(m, 0);
    for(auto& val: arr)
        cin >> val;
    int acc = accumulate(arr.begin(), arr.end(), 0);
    if (acc > n)
        cout << -1 << endl;
    else
        cout << n - acc << endl;

    return 0;
}

