//ABC163 B

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint n,m;
lint a[10000];


int main() {
  cin >> n >> m;

  lint sum_a = 0;
  rep(i,m){
    scanf("%lld",&a[i]);
    sum_a += a[i];
  }
  if(n >= sum_a){
    ans = n - sum_a;
  }
  else{
    ans = -1;
  }
  
  printf("%lld\n",ans);
}
