import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  }
} Main public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  } main {
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  } Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int x = s.nextInt(); x s.nextInt() s.nextInt s for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    } int i = 0; int i = 0; i 0 i < x i x i++ i++ i {
      n = n - s.nextInt();
    } {
      n = n - s.nextInt();
    } n = n - s.nextInt() n n - s.nextInt() n s.nextInt() s.nextInt s if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    } n < 0 n 0 {
      System.out.println(-1);
    } System.out.println(-1) System.out.println System.out System System.out -1 1 {
    System.out.println(n);
    } System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  }
} Main
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner s = new Scanner(System.in);
    int n = s.nextInt();
    int x = s.nextInt();
    for(int i = 0; i < x; i++){
      n = n - s.nextInt();
    }
    if(n < 0){
      System.out.println(-1);
    } else {
    System.out.println(n);
    }
  }
}