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

typedef long long ll;

const int N = 1000 * 1000 + 20;
ll n, m, a[N], sum;

int main() {
	cin >> n >> m;
    for (int i = 0; i < m; i++)
		cin >> a[i];
    for (int i = 0; i < m; i++)
		sum += a[i];
    cout << (sum <= n? n - sum: -1) << endl;
}