#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main()
{
    int n, m;
    cin >> n >> m;
    int a[m], sum = 0;
    for(int i = 0; i < m; i++){cin >> a[m];sum += a[m];}
    cout << (n - sum < 0 ? -1 :n - sum) << endl;
}