//
//  main.cpp
//  HelloWorld
//
//  Created by purple on 2020/04/13.
//  Copyright © 2020 Purple. All rights reserved.
//

#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>

using namespace std;

int main(int argc, const char * argv[]) {
    // insert code here...


    
    int n,m;
    
    cin >> n >> m;
    
    int a[m];
    
    for(int i=0; i<m; i++) std::cin >> a[i];

    int total =0;

    for(int i=0; i<m; i++) {
        total = total + a[i] ;
    }
    
    if((n-total) < 0)
        cout << -1 << endl;
    else
        cout << n-total << endl;
    
    return 0;
    
}
