#include <cmath>
#include <iostream>
#include <functional>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <iomanip>
#include <math.h>
#include <list>
#include <numeric>
using namespace std;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

long long gcd(int a, int b){
  if (a%b == 0){
    return(b);
  }
  else{
    return(gcd(b, a%b));
  }
}

int main(){    
  long long N,M;
  cin >> N >>M;
  
  long long A[M],sum=0,a;

  for(int i=0;i<M;i++){
    cin >> a;
    sum += a;
  }

  if(N-sum <= 0){
    cout << "-1" << endl;
  }
  else{
  cout << N-sum << endl;
  }
}
 
