import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    }
} Main public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    } main {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int[] a = new int[n]; a new int[n] n int ans = 0; ans 0 for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        } {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc ans += a[i] ans a[i] a i if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        } n >= ans n ans {
            System.out.println(n - ans);
        } System.out.println(n - ans) System.out.println System.out System System.out n - ans n ans {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 sc.close() sc.close sc final String[] args args public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    }
} public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(final String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        // String s = sc.next();
        int[] a = new int[n];
        int ans = 0;
        for (int i = 0; i < m; i++) {
            a[i] = Integer.parseInt(sc.next());
            ans += a[i];
        }

        if (n >= ans) {
            System.out.println(n - ans);
        } else {
            System.out.println(-1);
        }
        sc.close();
    }
}