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

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

    return 0;
}
