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

int main()
{
    int n, m;
    cin >> n >> m;
    int sum = 0, a;
    for(int i = 0; i < m; i++){
        cin >> a;
        sum += a;
    }

    if(n - sum >= 0) cout << n - sum << endl;
    else cout << -1 << endl;

}