#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n + 1); ++i)
using namespace std;
using ll = long long;
const int INF = +100100100;
// typedef pair<int,int> P;
const int MAX = 1000000;


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