#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
using namespace std;
using ll = long long;

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

}