#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
void chmin(T &a, const T &b) noexcept {
  if (b < a) a = b;
}
template <class T>
void chmax(T &a, const T &b) noexcept {
  if (a < b) a = b;
}
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n, sum = 0;
  int m;
  cin >> n >> m;
  vector<ll> A(m);
  for (int i = 0; i < (m); ++i) {
    cin >> A[i];
    sum += A[i];
  }
  ll ans = 0;
  if (sum <= n)
    ans = n - sum;
  else
    ans = -1;
  cout << ans << endl;
  return 0;
}
