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

int main()
{
    int n,m;
    cin>>n>>m;
    int count = 0;
    while(m)
    {
        int t;
        cin>>t;
        count += t;
        m--;
    }
    if(count > n)
    {
        cout<<"-1"<<endl;
    }
    else
    {
        cout<<(n-count)<<endl;
    }
    return 0;
}