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

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

    int ans = n - sum;

    if (sum < 0)
        sum = -1;

    cout << sum;
}