import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    }
} Main public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    } main {
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    } Scanner scn = new Scanner(System.in); scn new Scanner(System.in) String[] NM = (scn.nextLine()).split(" "); NM (scn.nextLine()).split(" ") (scn.nextLine()).split (scn.nextLine()) scn.nextLine scn " " int N = Integer.valueOf(NM[0]); N Integer.valueOf(NM[0]) Integer.valueOf Integer NM[0] NM 0 int M = Integer.valueOf(NM[1]); M Integer.valueOf(NM[1]) Integer.valueOf Integer NM[1] NM 1 String[] Am = (scn.nextLine()).split(" "); Am (scn.nextLine()).split(" ") (scn.nextLine()).split (scn.nextLine()) scn.nextLine scn " " int sum = 0; sum 0 int result = 0; result 0 for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        } int i=0; int i=0; i 0 i<M i M i++ i++ i {
            sum += Integer.valueOf(Am[i]);
        } {
            sum += Integer.valueOf(Am[i]);
        } sum += Integer.valueOf(Am[i]) sum Integer.valueOf(Am[i]) Integer.valueOf Integer Am[i] Am i if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        } sum <= N sum N {
            result = N -sum;
        } result = N -sum result N -sum N sum {
            result = -1;
        } result = -1 result -1 1 System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    }
} public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    }
} Main
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        String[] NM = (scn.nextLine()).split(" ");
        int N = Integer.valueOf(NM[0]);
        int M = Integer.valueOf(NM[1]);
        String[] Am = (scn.nextLine()).split(" ");
        int sum = 0;
        int result = 0;
        for(int i=0;i<M;i++){
            sum += Integer.valueOf(Am[i]);
        }
        if(sum <= N){
            result = N -sum;
        }else{
            result = -1;
        }
        System.out.println(result);

    }
}