import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] A = new int[M];
        int Study_sum = 0;


        for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        }
        
        for(int i=0; i<M; i++){
            Study_sum += A[i];
        }


        if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        }
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] A = new int[M];
        int Study_sum = 0;


        for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        }
        
        for(int i=0; i<M; i++){
            Study_sum += A[i];
        }


        if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        }
    }
} Main public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] A = new int[M];
        int Study_sum = 0;


        for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        }
        
        for(int i=0; i<M; i++){
            Study_sum += A[i];
        }


        if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        }
    } main {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] A = new int[M];
        int Study_sum = 0;


        for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        }
        
        for(int i=0; i<M; i++){
            Study_sum += A[i];
        }


        if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        }
    } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int N = stdIn.nextInt(); N stdIn.nextInt() stdIn.nextInt stdIn int M = stdIn.nextInt(); M stdIn.nextInt() stdIn.nextInt stdIn int[] A = new int[M]; A new int[M] M int Study_sum = 0; Study_sum 0 for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        } int i = 0; int i = 0; i 0 i<M i M i++ i++ i {
            A[i] = stdIn.nextInt();
        } {
            A[i] = stdIn.nextInt();
        } A[i] = stdIn.nextInt() A[i] A i stdIn.nextInt() stdIn.nextInt stdIn for(int i=0; i<M; i++){
            Study_sum += A[i];
        } int i=0; int i=0; i 0 i<M i M i++ i++ i {
            Study_sum += A[i];
        } {
            Study_sum += A[i];
        } Study_sum += A[i] Study_sum A[i] A i if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        } (N-Study_sum)>=0 (N-Study_sum) N Study_sum 0 {
            System.out.print(N-Study_sum);
        } System.out.print(N-Study_sum) System.out.print System.out System System.out N-Study_sum N Study_sum {
            System.out.print("-1");
        } System.out.print("-1") System.out.print System.out System System.out "-1" String[] args args
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        int[] A = new int[M];
        int Study_sum = 0;


        for (int i = 0; i<M; i++){
            A[i] = stdIn.nextInt();
        }
        
        for(int i=0; i<M; i++){
            Study_sum += A[i];
        }


        if ((N-Study_sum)>=0){
            System.out.print(N-Study_sum);
        }
        else{
            System.out.print("-1");
        }
    }
}