import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    }
 
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    }
 
} Main public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    } main {
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int day = in.nextInt(); day in.nextInt() in.nextInt in int number = in.nextInt(); number in.nextInt() in.nextInt in int sum = 0; sum 0 for(int i = 0; i < number; i++){
            sum += in.nextInt();
        } int i = 0; int i = 0; i 0 i < number i number i++ i++ i {
            sum += in.nextInt();
        } {
            sum += in.nextInt();
        } sum += in.nextInt() sum in.nextInt() in.nextInt in if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        } sum<=day sum day {
            System.out.print(day-sum);
        } System.out.print(day-sum) System.out.print System.out System System.out day-sum day sum {
            System.out.print(-1);
        } System.out.print(-1) System.out.print System.out System System.out -1 1 String[] args args public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    }
 
} public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    }
 
} Main
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int day = in.nextInt();
        int number = in.nextInt();
        int sum = 0;
        for(int i = 0; i < number; i++){
            sum += in.nextInt();
        }
        if(sum<=day){
            System.out.print(day-sum);
        }
        else{
            System.out.print(-1);
        }
    }
 
}