#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  ll n,m;
  cin >>n>>m;
  vector<ll> vec(m);
  ll key=0;
  rep(i,m){
    cin >>vec[i];
    key+=vec[i];
  }
  if(key>n){
    cout <<-1<<endl;
  }else{
    cout <<n-key<<endl;
  } 
}