import java.util.*;

public class Main {

    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    }
} import java.util.*; util.* java public class Main {

    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    }
} Main public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    } main {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = scan.nextInt(); n scan.nextInt() scan.nextInt scan int m = scan.nextInt(); m scan.nextInt() scan.nextInt scan for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            n -= scan.nextInt();
        } {
            n -= scan.nextInt();
        } n -= scan.nextInt() n scan.nextInt() scan.nextInt scan if (n >= 0) System.out.println(n);
        else System.out.println(-1); n >= 0 n 0 System.out.println(n) System.out.println System.out System System.out n System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args public class Main {

    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    }
} public class Main {

    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    }
} Main
import java.util.*;

public class Main {

    
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        for (int i = 0; i < m; i++) {
            n -= scan.nextInt();
        }
        if (n >= 0) System.out.println(n);
        else System.out.println(-1);
    }
}