
import java.util.Arrays;
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();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  }
}
 import java.util.Arrays; Arrays java.util 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();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  } 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 int[] arr = new int[m]; arr new int[m] m for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
      arr[i] = sc.nextInt();
    } {
      arr[i] = sc.nextInt();
    } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc long sum = Arrays.stream(arr).sum(); sum Arrays.stream(arr).sum() Arrays.stream(arr).sum Arrays.stream(arr) Arrays.stream Arrays arr if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    } n - sum < 0 n - sum n sum 0 {
      System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" {
      System.out.println(n - sum);
    } System.out.println(n - sum) System.out.println System.out System System.out n - sum n sum 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();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  }
} Main

import java.util.Arrays;
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();
    int[] arr = new int[m];
    for (int i = 0; i < arr.length; i++) {
      arr[i] = sc.nextInt();
    }
    long sum = Arrays.stream(arr).sum();
    if (n - sum < 0) {
      System.out.println("-1");
    } else {
      System.out.println(n - sum);
    }
  }
}

