#include <bits/stdc++.h>
#define ll long long
#define PI 3,14
using namespace std;

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