#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)

int main() {
  int N, M;
  cin >> N >> M;
  
  vector<int> A(M);
  rep(i, M) cin >> A.at(i);
  
  int sum = 0;
  rep(i, M) sum += A.at(i);
  
  int ans;
  if (N < sum) {
    cout << "-1" << endl;
  }
  
  else {
    ans = N - sum;
    cout << ans << endl;
  }
}