import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

    System.out.println(N);
    sc.close();
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

    System.out.println(N);
    sc.close();
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

    System.out.println(N);
    sc.close();
  } main {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

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

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

    System.out.println(N);
    sc.close();
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

    System.out.println(N);
    sc.close();
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);

    int N = sc.nextInt();
    int M = sc.nextInt();
    sc.nextLine();

    int[] list = new int[M];

    for(int i = 0; i < M; i++) {
      list[i] = sc.nextInt();
    }

    for(int i : list) {
      N -= i;
    }

    if(N <= -1) {
      N = -1;
    }

    System.out.println(N);
    sc.close();
  }
}