import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int n = Integer.parseInt(str[0]); n Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int m = Integer.parseInt(str[1]); m Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 String[] a = br.readLine().split(" "); a br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            n = n - Integer.parseInt(a[i]);
        } {
            n = n - Integer.parseInt(a[i]);
        } n = n - Integer.parseInt(a[i]) n n - Integer.parseInt(a[i]) n Integer.parseInt(a[i]) Integer.parseInt Integer a[i] a i if (n < 0) {
            n = -1;
        } n < 0 n 0 {
            n = -1;
        } n = -1 n -1 1 System.out.println(n) System.out.println System.out System System.out n String[] args args public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    }
} public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String[] str = br.readLine().split(" ");
        int n = Integer.parseInt(str[0]);
        int m = Integer.parseInt(str[1]);
        String[] a = br.readLine().split(" ");

        for (int i = 0; i < m; i++) {
            n = n - Integer.parseInt(a[i]);
        }

        if (n < 0) {
            n = -1;
        }
        System.out.println(n);
    }
}
