import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    }
} Main public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    } main {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    } int N N M; M Scanner sc = new Scanner(System.in); sc new Scanner(System.in) N = sc.nextInt() N sc.nextInt() sc.nextInt sc M = sc.nextInt() M sc.nextInt() sc.nextInt sc int temp = 0; temp 0 while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        } M > 0 M 0 {
            temp = sc.nextInt();
            N -= temp;
            M--;
        } temp = sc.nextInt() temp sc.nextInt() sc.nextInt sc N -= temp N temp M-- M System.out.println(N >=0 ? N : -1) System.out.println System.out System System.out N >=0 ? N : -1 N >=0 N 0 N -1 1 String[] args args public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    }
} public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        int N, M;
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        M = sc.nextInt();
        int temp = 0;
        while (M > 0)
        {
            temp = sc.nextInt();
            N -= temp;
            M--;
        }
        System.out.println(N >=0 ? N : -1);
    }
}
