import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int day = scan.nextInt();
        int homework = scan.nextInt();
        int sum = 0;
        int suji[] = new int[homework];
        for(int j = 0; j < suji.length; j++){
            suji[j] = scan.nextInt();
        }
        for(int i = 0; i < suji.length; i++){
            sum += suji[i];
        }
        int canPlay;
        canPlay = day - sum; 
        if(canPlay >=0){
            System.out.println(canPlay);
        }else{
            System.out.println(-1);
        }
    }
} import java.util.Scanner; Scanner java.util class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int day = scan.nextInt();
        int homework = scan.nextInt();
        int sum = 0;
        int suji[] = new int[homework];
        for(int j = 0; j < suji.length; j++){
            suji[j] = scan.nextInt();
        }
        for(int i = 0; i < suji.length; i++){
            sum += suji[i];
        }
        int canPlay;
        canPlay = day - sum; 
        if(canPlay >=0){
            System.out.println(canPlay);
        }else{
            System.out.println(-1);
        }
    }
} Main public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int day = scan.nextInt();
        int homework = scan.nextInt();
        int sum = 0;
        int suji[] = new int[homework];
        for(int j = 0; j < suji.length; j++){
            suji[j] = scan.nextInt();
        }
        for(int i = 0; i < suji.length; i++){
            sum += suji[i];
        }
        int canPlay;
        canPlay = day - sum; 
        if(canPlay >=0){
            System.out.println(canPlay);
        }else{
            System.out.println(-1);
        }
    } main {
        Scanner scan = new Scanner(System.in);
        int day = scan.nextInt();
        int homework = scan.nextInt();
        int sum = 0;
        int suji[] = new int[homework];
        for(int j = 0; j < suji.length; j++){
            suji[j] = scan.nextInt();
        }
        for(int i = 0; i < suji.length; i++){
            sum += suji[i];
        }
        int canPlay;
        canPlay = day - sum; 
        if(canPlay >=0){
            System.out.println(canPlay);
        }else{
            System.out.println(-1);
        }
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int day = scan.nextInt(); day scan.nextInt() scan.nextInt scan int homework = scan.nextInt(); homework scan.nextInt() scan.nextInt scan int sum = 0; sum 0 int suji[] = new int[homework]; suji new int[homework] homework for(int j = 0; j < suji.length; j++){
            suji[j] = scan.nextInt();
        } int j = 0; int j = 0; j 0 j < suji.length j suji.length suji suji.length j++ j++ j {
            suji[j] = scan.nextInt();
        } {
            suji[j] = scan.nextInt();
        } suji[j] = scan.nextInt() suji[j] suji j scan.nextInt() scan.nextInt scan for(int i = 0; i < suji.length; i++){
            sum += suji[i];
        } int i = 0; int i = 0; i 0 i < suji.length i suji.length suji suji.length i++ i++ i {
            sum += suji[i];
        } {
            sum += suji[i];
        } sum += suji[i] sum suji[i] suji i int canPlay; canPlay canPlay = day - sum canPlay day - sum day sum if(canPlay >=0){
            System.out.println(canPlay);
        }else{
            System.out.println(-1);
        } canPlay >=0 canPlay 0 {
            System.out.println(canPlay);
        } System.out.println(canPlay) System.out.println System.out System System.out canPlay {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 String args[] args
import java.util.Scanner;
class Main{
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int day = scan.nextInt();
        int homework = scan.nextInt();
        int sum = 0;
        int suji[] = new int[homework];
        for(int j = 0; j < suji.length; j++){
            suji[j] = scan.nextInt();
        }
        for(int i = 0; i < suji.length; i++){
            sum += suji[i];
        }
        int canPlay;
        canPlay = day - sum; 
        if(canPlay >=0){
            System.out.println(canPlay);
        }else{
            System.out.println(-1);
        }
    }
}