
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int N = sc.nextInt();
    int M = sc.nextInt();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  }
} import java.util.Scanner; Scanner 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();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  }
} Main public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int N = sc.nextInt();
    int M = sc.nextInt();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  } main {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int N = sc.nextInt();
    int M = sc.nextInt();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  } 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 for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
      int ai = sc.nextInt();
      N = N - ai;
    } {
      int ai = sc.nextInt();
      N = N - ai;
    } int ai = sc.nextInt(); ai sc.nextInt() sc.nextInt sc N = N - ai N N - ai N ai System.out.println(N < 0 ? -1 : N) System.out.println System.out System System.out N < 0 ? -1 : N N < 0 N 0 -1 1 N 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();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  }
} public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int N = sc.nextInt();
    int M = sc.nextInt();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  }
} Main

import java.util.Scanner;

public class Main {

  public static void main(String[] args) {

    Scanner sc = new Scanner(System.in);
    // 整数の入力
    int N = sc.nextInt();
    int M = sc.nextInt();

    for (int i = 0; i < M; i++) {
      int ai = sc.nextInt();
      N = N - ai;
    }

    // 出力
    System.out.println(N < 0 ? -1 : N);
  }
}
