#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;

const ll mod = 1e9 + 7;
const ll MAXN = 1e5 + 5;

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);cout.tie(0);

  ll n,m;
  cin >> n >> m;
  ll ans = 0;
  for(int i = 0; i < m; i++){
    ll a;
    cin >> a;
    ans += a;
  }
  if(n - ans >= 0) cout << n - ans << endl;
  else cout << -1 << endl;
}
