import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner stdIn=new Scanner(System.in);

        int date=stdIn.nextInt();
        int homework=stdIn.nextInt();
        System.out.println();

        int [] a=new int[homework];
        for(int i=0; i<homework; i++){
            a[i]=stdIn.nextInt();
        }
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i];
        }
        int free=date-sum;
        if(free>=0){
        System.out.print(free);
        }
        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 date=stdIn.nextInt();
        int homework=stdIn.nextInt();
        System.out.println();

        int [] a=new int[homework];
        for(int i=0; i<homework; i++){
            a[i]=stdIn.nextInt();
        }
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i];
        }
        int free=date-sum;
        if(free>=0){
        System.out.print(free);
        }
        else{
            System.out.print(-1);
            
        }
    }

} Main public static void main(String[] args) {
        Scanner stdIn=new Scanner(System.in);

        int date=stdIn.nextInt();
        int homework=stdIn.nextInt();
        System.out.println();

        int [] a=new int[homework];
        for(int i=0; i<homework; i++){
            a[i]=stdIn.nextInt();
        }
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i];
        }
        int free=date-sum;
        if(free>=0){
        System.out.print(free);
        }
        else{
            System.out.print(-1);
            
        }
    } main {
        Scanner stdIn=new Scanner(System.in);

        int date=stdIn.nextInt();
        int homework=stdIn.nextInt();
        System.out.println();

        int [] a=new int[homework];
        for(int i=0; i<homework; i++){
            a[i]=stdIn.nextInt();
        }
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i];
        }
        int free=date-sum;
        if(free>=0){
        System.out.print(free);
        }
        else{
            System.out.print(-1);
            
        }
    } Scanner stdIn=new Scanner(System.in); stdIn new Scanner(System.in) int date=stdIn.nextInt(); date stdIn.nextInt() stdIn.nextInt stdIn int homework=stdIn.nextInt(); homework stdIn.nextInt() stdIn.nextInt stdIn System.out.println() System.out.println System.out System System.out int [] a=new int[homework]; a new int[homework] homework for(int i=0; i<homework; i++){
            a[i]=stdIn.nextInt();
        } int i=0; int i=0; i 0 i<homework i homework i++ i++ i {
            a[i]=stdIn.nextInt();
        } {
            a[i]=stdIn.nextInt();
        } a[i]=stdIn.nextInt() a[i] a i stdIn.nextInt() stdIn.nextInt stdIn int sum=0; sum 0 for(int i=0; i<a.length; i++){
            sum+=a[i];
        } int i=0; int i=0; i 0 i<a.length i a.length a a.length i++ i++ i {
            sum+=a[i];
        } {
            sum+=a[i];
        } sum+=a[i] sum a[i] a i int free=date-sum; free date-sum date sum if(free>=0){
        System.out.print(free);
        }
        else{
            System.out.print(-1);
            
        } free>=0 free 0 {
        System.out.print(free);
        } System.out.print(free) System.out.print System.out System System.out free {
            System.out.print(-1);
            
        } System.out.print(-1) System.out.print System.out System System.out -1 1 String[] args args
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner stdIn=new Scanner(System.in);

        int date=stdIn.nextInt();
        int homework=stdIn.nextInt();
        System.out.println();

        int [] a=new int[homework];
        for(int i=0; i<homework; i++){
            a[i]=stdIn.nextInt();
        }
        int sum=0;
        for(int i=0; i<a.length; i++){
            sum+=a[i];
        }
        int free=date-sum;
        if(free>=0){
        System.out.print(free);
        }
        else{
            System.out.print(-1);
            
        }
    }

}