import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    }
} Main public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    } main {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    } Scanner s = new Scanner(System.in); s new Scanner(System.in) long N = s.nextLong(); N s.nextLong() s.nextLong s int M = s.nextInt(); M s.nextInt() s.nextInt s long[] a = new long[M]; a new long[M] M for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
            a[i] = s.nextLong();
        } {
            a[i] = s.nextLong();
        } a[i] = s.nextLong() a[i] a i s.nextLong() s.nextLong s long sum = 0; sum 0 for (int i = 0; i < a.length; i++) {
            sum += a[i];
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            sum += a[i];
        } {
            sum += a[i];
        } sum += a[i] sum a[i] a i if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        } N >= sum N sum {
            System.out.println(N-sum);
        } System.out.println(N-sum) System.out.println System.out System System.out N-sum N sum {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" String[] args args public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        long N = s.nextLong();
        int M = s.nextInt();
        long[] a = new long[M];
        for (int i = 0; i < M; i++) {
            a[i] = s.nextLong();
        }

        long sum = 0;
        for (int i = 0; i < a.length; i++) {
            sum += a[i];
        }

        if(N >= sum) {
            System.out.println(N-sum);
        } else {
            System.out.println("-1");
        }
        // double ans = 2 * 3.14159 * q;
        // System.out.println(ans);
    }
}