#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    int n , m ;
    cin >> n >> m ;
    int a ;
    int ans = 0 ;
    for(int i = 0 ; i < m ; i++){
        cin >> a ;
        ans += a ;
    }

    if(ans >n){
        cout << -1 << endl;
    }else{
        cout << n - ans << endl;
    }

    return 0 ;
}

 
