#include <bits/stdc++.h>
using namespace std;

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


