#include <bits/stdc++.h>
using namespace std;
// define #Asukaminato is cute
#define ll long long
#define rep(i, m) for (int i = 0; i < (int)(m); i++)
const int inf = 1000000000; // 10^9 Ten to the power of nine.

   int main() {
      int N,M ;
      cin>>N>>M;
      int sum=0;

      for (int i = 0; i < M; i++)
      {
         cin>>A[i]; sum+=A[i];
      }
      
      if(N>=sum){cout<<N-sum;}
      else{cout<<-1;}

   }
	
