#include<bits/stdc++.h>
using namespace std;
int main(){

   long long int a,b,c,d=0,e,f,g,i,j,k,t=0,u=0,w,nt;
   double res;
   string x,y;
   char ch,ch1;
   vector<int> v;
   map<int,char> mp;
   map<int,char> mp2;
   vector<string> v1;
   set<int> s;
  cin>>a>>b;
  while(b--){
     cin>>c;
     t+=c;
  }
  if(a-t<0){
     cout<<-1<<endl;
  }
  else cout<<a-t<<endl;




 return 0;
}
