import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    } main {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            M -= sc.nextInt();
        } {
            M -= sc.nextInt();
        } M -= sc.nextInt() M sc.nextInt() sc.nextInt sc System.out.println(M >= 0 ? M : -1) System.out.println System.out System System.out M >= 0 ? M : -1 M >= 0 M 0 M -1 1 String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int M = sc.nextInt();
        int N = sc.nextInt();
        int[] A = new int[N];

        for (int i = 0; i < N; i++) {
            M -= sc.nextInt();
        }

        System.out.println(M >= 0 ? M : -1);
        
    }
}
