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

int main()
{
    double n, m, x, sum=0;
    cin >> n >> m;

//    int arr[m];

    for(int i=1;i<=m;i++)
    {
        cin >>x;
        sum=sum+x;
    }

    if(sum>n) cout << "-1" <<endl;
    else if (sum==n) cout << "0" <<endl;
    else cout << n-sum << endl;

    return 0;
}

