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();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        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();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        sc.close();

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        sc.close();

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        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 int sum = 0; sum 0 for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            int x = sc.nextInt();
            sum += x;
        } {
            int x = sc.nextInt();
            sum += x;
        } int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc sum += x sum x System.out.println(n-sum < 0 ? -1 : n-sum) System.out.println System.out System System.out n-sum < 0 ? -1 : n-sum n-sum < 0 n-sum n sum 0 -1 1 n-sum n sum 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();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        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();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        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();
        int sum = 0;
        for (int i = 0; i < m; i++) {
            int x = sc.nextInt();
            sum += x;
        }
        System.out.println(n-sum < 0 ? -1 : n-sum);
        sc.close();

    }

}
