
import java.util.Scanner;

public class Main {

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

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

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

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

import java.util.Scanner;

public class Main {

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