#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
  
  int n,m;
  cin >> n>>m;
  int sum = 0;
  rep(i,0,m){
      int a;
      cin >> a;
      sum += a;
  }
  if(n<sum){
      cout << -1 << endl;
  }else{
      cout << n-sum << endl;
  }

  return 0;
}