#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
int main(){
 	int n, m;
  cin >> n >> m;
  int sum=0, tmp=0;
  rep(i, m) {
    cin >> tmp;
    sum += tmp;
  }
  if(sum <= n) cout << n - sum << endl;
  else cout << -1 << endl;
}