#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cmath>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
  int N,M;
  vector<int> homework(M);
  int kei=0;

  cin >> N;
  cin >> M;

  for(int i = 0;i < M;i++){
    cin >> homework.at(i);
    kei += homework.at(i);
  }
  if(N >= kei){
    cout << N-kei << endl;
  }else{
    cout << "-1" << endl;
  }
}
