import java.util.*;

public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
}
} import java.util.*; util.* java public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
}
} Main public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
} main {
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int days = sc.nextInt(); days sc.nextInt() sc.nextInt sc int homeworks = sc.nextInt(); homeworks sc.nextInt() sc.nextInt sc int sum = 0; sum 0 int temp =0; temp 0 for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  } int i=0; int i=0; i 0 i<homeworks i homeworks i++ i++ i {
  temp = sc.nextInt();
    sum += temp;
  } {
  temp = sc.nextInt();
    sum += temp;
  } temp = sc.nextInt() temp sc.nextInt() sc.nextInt sc sum += temp sum temp int result = days- sum; result days- sum days sum if (result < 0){
  result = -1;
  } result < 0 result 0 {
  result = -1;
  } result = -1 result -1 1 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
}
} public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
}
} Main
import java.util.*;

public class Main {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  
// 整数の入力
int days = sc.nextInt();
int homeworks = sc.nextInt();
int sum = 0;
int temp =0;
  for (int i=0;i<homeworks;i++){
  temp = sc.nextInt();
    sum += temp;
  }
  
  int result = days- sum;
  if (result < 0){
  result = -1;
  }
System.out.println(result);
}
}