#include<bits/stdc++.h>
#define ll long long

using namespace std;

ll n,m,x,sum;

int main()
{
    cin >> n >> m;
    for (int i=0;i<m;i++)
    {
        cin >> x;
        sum+=x;
    }
    if (sum>n)cout << -1 << endl;
    else cout << n-sum << endl;
    return 0;
}
