#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

int main() {
    using vi = vector<int>;
    
    int n,m;
    cin >> n >> m;
    vi a(m);
    rep(i,m){
        cin >> a[i];
    }
    int s = 0;
    rep(i,m){
        s+=a[i];
    }
    if(n-s>=0){
        cout << n-s << endl;
    }else{
        cout << -1 << endl;
    }
}