#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>

// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

using namespace std;
using namespace __gnu_pbds;

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 3e18 + 8;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9;

const int maxn = 1e5 + 7;

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n, m;
    cin >> n >> m;
    int sum = 0;
    for(int i = 1; i <= m; i++)
    {
        int a;
        cin >> a;
        sum += a;
    }
    if(sum > n)
        cout << -1;
    else
        cout << (n - sum);
    
    return 0;
}