import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    }
} Main public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    } main {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    } final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) final int s = in.nextInt(); s in.nextInt() in.nextInt in final int n = in.nextInt(); n in.nextInt() in.nextInt in in.nextLine() in.nextLine in int total = 0; total 0 for (int i = 0; i < n; i++) {
            total += in.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            total += in.nextInt();
        } {
            total += in.nextInt();
        } total += in.nextInt() total in.nextInt() in.nextInt in System.out.println(total > s ? -1 : s - total) System.out.println System.out System System.out total > s ? -1 : s - total total > s total s -1 1 s - total s total String[] args args public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    }
} public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        final Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        final int s = in.nextInt();
        final int n = in.nextInt();
        in.nextLine();
        int total = 0;
        for (int i = 0; i < n; i++) {
            total += in.nextInt();
        }
        System.out.println(total > s ? -1 : s - total);
    }
}
