#include <stdio.h>

int main(void){
  int n, m, a, i;
  scanf("%d %d", &n, &m);
  while(scanf("%d", &a) != EOF && i++ < m){
    n -= a;
    if(n < 0){
      n = -1;
      break;
    }
  }
  printf("%d\n", n);
  return 0;
}