#include <bits/stdc++.h>
using namespace std;
 
     int main() {
     int N,M,A,sum;
      cin>>N>>M;
      sum=0;
      while(cin>>A){
      sum+=A;}
      if(N>=sum){cout<<N-sum<<endl;}
      else{cout<<-1<<endl;}
      return 0;
    }