#include <iostream>
using namespace std;
using ll = long long;
int main() {
    ll n, m;
    ll kadai[m];
    cin >> n >> m;
    ll prop = 0;
    for (ll i = 0; i < m; i++)
    {
        cin >> kadai[i];
        prop += kadai[i];
    }
    if(prop > n){
        cout << -1 << endl;
    }else{
        cout << n - prop << endl;
    }
}