#include <math.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

typedef unsigned long long int ull;
typedef long long int ll;
typedef long double ld;

int main(void) {
  int scan; // scanf result
  int answer; // to output 
  int n; // to input 
  int m; // to input 
  int *times;
  int home;

  home = 0;
  scan = scanf("%d", &n);
  scan = scanf("%d", &m);
  times = (int *)malloc(sizeof(int) * m);
  for (int i = 0; i < m; i++) {
    scan = scanf("%d", &times[i]);
  }

  for (int i = 0; i < m; i++) {
    home += times[i];
  }

  if (home > n) {
    answer = -1;
  } else {
    answer = n - home;
  }  

  printf("%d", answer);
  return (0);
}
