//Author : Sidiq Tri Pratikto
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(v) v.begin(), v.end()

using namespace std;
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> new_data_set;
//order_of_key(x) = number of elements stricly smaller than x
//find_by_order(x) = return x-th largest element
typedef long long LL;
const LL MOD = 998244353;
const double PI = 2 * acos(0);

int main() {
	int N, M;
	scanf("%d%d", &N, &M);
	while (M--) {
		int x;
		scanf("%d", &x);
		N -= x;
	}
	if (N < 0) printf("-1\n");
	else printf("%d\n", N);
}