#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  int sum = 0;
  cin >> n >> m;
  int arr[n];
  for (int i = 0; i < m; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < m; i++) {
    sum += arr[i];
  }
  if (sum > n) cout << -1;
  if (sum <= n)
    ;
  cout << (n - sum);
}
