import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  }
} Main public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  } main {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int M = scanner.nextInt(); M scanner.nextInt() scanner.nextInt scanner for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
      N = N - scanner.nextInt();
    } {
      N = N - scanner.nextInt();
    } N = N - scanner.nextInt() N N - scanner.nextInt() N scanner.nextInt() scanner.nextInt scanner if(N < 0) N = -1; N < 0 N 0 N = -1 N -1 1 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 scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  }
} public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  }
} Main
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    int M = scanner.nextInt();
    for(int i = 0;i < M;i++){
      N = N - scanner.nextInt();
    }
    if(N < 0) N = -1;
    System.out.println(N);
  }
}