#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iterator>
#include <algorithm>
#include <map>
#include <string.h>
#include <vector>
#include <cmath>
#include <deque>
#include <iomanip>

using namespace std;
#define range(a) a.begin(), a.end()
#define rep(i, c) for(int i = 0; i < (int)c; i++)
typedef long long ll;

template <typename T> ostream& operator<<(ostream& out, vector<T> &v){
  for (int i = 0; i < (int)v.size(); i++) {
    out<<v[i]<<' ';
  }
  return out;
}

int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);

  // float n; cin >> n;
  //
  // cout << n * 2 * 3.141592653589 << endl;

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








  return 0;
}
