#include<bits/stdc++.h>
using namespace std;
#define ll  long long
#define FASTINOUT ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
const ll mod = 1e9+7;
const int N=1e7+9;
int main()
{
    FASTINOUT;
    int x,k,y;
    cin>>x>>k;
    int sum=0;
    for (int i=0;i<k;i++)
    {
        cin>>y;
        sum+=y;
    }
    if (sum<=x)
        cout<<x-sum<<endl;
    else
        cout<<-1<<endl;
    return 0;
}
