#include <bits/stdc++.h>
#include<queue>
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef pair<string,string> Pstring;
typedef pair<double,double> Pdouble;

#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define Precision13 cout << fixed << setprecision(13)
ll MOD = 1e9+7;
const double PI=3.14159265358979323846;


int main() {
  ll n,m;
  cin >> n>> m;
  vector<ll> a(m);
  ll sum = 0;
  REP(i,m){
    cin >> a.at(i);
    sum += a.at(i);
  }
  if(sum>n){
    cout << -1 << endl;
  }else{
    cout << n-sum << endl;
  }
}