#include <bits/stdc++.h>
 
//g++ -std=c++11
//g++ -std=c++1z 

using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector< pair<int,int> > vp;

int main() {
 
    //freopen("input.txt", "r", stdin); 
    //freopen("output.txt", "w", stdout);
 
    std::ios::sync_with_stdio(false);
    cin.tie(nullptr);

   	int n,m,x;
    ll sum = 0;
    cin >> n >> m;
    for (int i=0; i<m; i++) {
      cin >> x;
      sum += x;
    }

    if(sum >= 0)
      cout << n-sum << endl;
    else
      cout << -1 << endl;

    return 0;
}