import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Long> list = new ArrayList<>();
        int h = sc.nextInt(), w = sc.nextInt();
        for (int i = 0; i < w; i++) {
            list.add(sc.nextLong());
            h -=list.get(i);
        }
        System.out.println (h < 0 ? -1 : h);
    }
} import java.util.*; util.* java import java.util.stream.IntStream; IntStream java.util.stream import java.util.stream.Stream; Stream java.util.stream class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Long> list = new ArrayList<>();
        int h = sc.nextInt(), w = sc.nextInt();
        for (int i = 0; i < w; i++) {
            list.add(sc.nextLong());
            h -=list.get(i);
        }
        System.out.println (h < 0 ? -1 : h);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Long> list = new ArrayList<>();
        int h = sc.nextInt(), w = sc.nextInt();
        for (int i = 0; i < w; i++) {
            list.add(sc.nextLong());
            h -=list.get(i);
        }
        System.out.println (h < 0 ? -1 : h);
    } main {
        Scanner sc = new Scanner(System.in);
        List<Long> list = new ArrayList<>();
        int h = sc.nextInt(), w = sc.nextInt();
        for (int i = 0; i < w; i++) {
            list.add(sc.nextLong());
            h -=list.get(i);
        }
        System.out.println (h < 0 ? -1 : h);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Long> list = new ArrayList<>(); list new ArrayList<>() int h = sc.nextInt() h sc.nextInt() sc.nextInt sc w = sc.nextInt(); w sc.nextInt() sc.nextInt sc for (int i = 0; i < w; i++) {
            list.add(sc.nextLong());
            h -=list.get(i);
        } int i = 0; int i = 0; i 0 i < w i w i++ i++ i {
            list.add(sc.nextLong());
            h -=list.get(i);
        } {
            list.add(sc.nextLong());
            h -=list.get(i);
        } list.add(sc.nextLong()) list.add list sc.nextLong() sc.nextLong sc h -=list.get(i) h list.get(i) list.get list i System.out.println (h < 0 ? -1 : h) System.out.println System.out System System.out h < 0 ? -1 : h h < 0 h 0 -1 1 h String[] args args
import java.util.*;
import java.util.stream.IntStream;
import java.util.stream.Stream;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        List<Long> list = new ArrayList<>();
        int h = sc.nextInt(), w = sc.nextInt();
        for (int i = 0; i < w; i++) {
            list.add(sc.nextLong());
            h -=list.get(i);
        }
        System.out.println (h < 0 ? -1 : h);
    }
}
