#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}
template<typename T>
ostream& operator << (ostream& os, vector<T>& vs){
  for (const T& v : vs) os << v << " ";
  return os;
}

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 (N >= sum)
    cout << N - sum << endl;
  else
    cout << -1 << endl;
}
