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

#define ll long long

int main()
{
    int n,m;
    cin>>n>>m;
    ll sum=0;
    int a;
    while(m--)
    {
        cin>>a;
        sum+=a;
    }
    if(sum>n)
        cout<<-1<<endl;
    else
        cout<<n-sum<<endl;
}
