#include<bits/stdc++.h>
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
int main(){
  int n,m;cin>>n>>m;
  int a,sum=0;
  rep(i,m){cin>>a;sum+=a;}
  cout<<(sum>n?-1:n-sum);
}