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