#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const long long INFL = 0x3f3f3f3f3f3f3f3f;
int a[2000000];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    scanf("%d", &a[i]);
    n -= a[i];
  }
  if (n < 0)
    puts("-1");
  else
    cout << n << endl;
}
