#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int(i) = 0; (i) < (n); (i)++)
int main(){
  int N, M;
  cin >> N >> M;
  int64_t ans = 0;
  int now = 0;
  rep(i,M){
    int Ai;
    cin >> Ai;
    ans += Ai;
  }
  if (N >= ans){
    cout << N - ans << endl;
  }else{
    cout << -1 << endl;
  }
}