#include <iostream>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bits/stdc++.h>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
#include <stdlib.h>
#include <deque>
using namespace std;
 
int main () {
  int n, m;
  cin >> n >> m;
  int sum = 0;
  for (int i = 0; i < m; i++){
    int a;
    cin >> a;
    sum += a;
  }
  if (sum <= n){
    cout << n - sum;
  }else{
    cout << "-1";
  }

  return 0;
}