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

int main(){
  int n,m;
  cin >> n >> m;
  vector<int> A(m+10);
  int ans = 0;
  rep(i,m){
    cin >> A[i];
    ans += A[i];
  }
  if(ans <= n) cout << n-ans << endl;
  else puts("-1");
  return 0;
}
