import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    }
} Main public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    } main {
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int n=scan.nextInt(); n scan.nextInt() scan.nextInt scan int m=scan.nextInt(); m scan.nextInt() scan.nextInt scan long cnt=0; cnt 0 for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
            cnt+=scan.nextLong();
        } {
            cnt+=scan.nextLong();
        } cnt+=scan.nextLong() cnt scan.nextLong() scan.nextLong scan if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1); n-cnt>-1 n-cnt n cnt -1 1 System.out.println(n-cnt) System.out.println System.out System System.out n-cnt n cnt System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan=new Scanner(System.in);
        int n=scan.nextInt();
        int m=scan.nextInt();

        long cnt=0;
        for(int i=0;i<m;i++){
            cnt+=scan.nextLong();
        }
        if(n-cnt>-1) System.out.println(n-cnt);
        else System.out.println(-1);
    }
}