import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            n -= Integer.parseInt(sc.next());
        } {
            n -= Integer.parseInt(sc.next());
        } n -= Integer.parseInt(sc.next()) n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        } n <= -1 n -1 1 {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(n);
        } 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 = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    }
} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        for (int i = 0; i < m; i++) {
            n -= Integer.parseInt(sc.next());
        }
        if (n <= -1) {
            System.out.println("-1");
        } else {
            System.out.println(n);
        }
        sc.close();
    }
}
