#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{


        ll n,k,sm=0;
        cin>>n>>k;
        vector<int>v;
        for(int i=0; i<k; i++)
        {
            int x;
            cin>>x;
            v.push_back(x);
            sm+=x;
        }

        ll x=n-sm;

        if(x<0)
        {
            cout<<-1<<endl;
        }
        else
        {
            cout<<x<<endl;
        }






    return 0;
}
