import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     }
} Main public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     } main {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int[] A = new int[(int)(M)]; A new int[(int)(M)] (int)(M) int a = 0; a 0 for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        } int i = 0 ; int i = 0 ; i 0 i < M i M i++ i++ i {
                A[i] = sc.nextInt();
                a = a + A[i];
        } {
                A[i] = sc.nextInt();
                a = a + A[i];
        } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc a = a + A[i] a a + A[i] a A[i] A i if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        } a > N a N {
            System.out.print(-1);
        } System.out.print(-1) System.out.print System.out System System.out -1 1 {
            int b = N - a;
            System.out.print(b);
        } int b = N - a; b N - a N a System.out.print(b) System.out.print System.out System System.out b String[] args args public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     }
} public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     }
} Main
import java.util.Scanner;
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] A = new int[(int)(M)];
        int a = 0;
        for(int i = 0 ; i < M ; i++){
                A[i] = sc.nextInt();
                a = a + A[i];
        }
        if(a > N){
            System.out.print(-1);
        }else{
            int b = N - a;
            System.out.print(b);
        }
     }
}