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