#include <iostream>
#include <stdio.h>
#include <vector>

typedef long long ll;

#define rep(i,n) for(int i = 0; i < n; i++)
#define debug(x) cerr << #x << ": " << x << "\n";

using namespace std;
 
const ll INF = ll(1e18)+1;
const double PI=3.14159265358979323846;

int main(){
  int N, M, total = 0;
  cin >> N >> M;

  int x;  
  rep(i,M){
    cin >> x;
    total+=x;
  }
  if(N-total<0) cout << -1 << endl;
  else cout << N-total << endl;
  
}
