import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    }
} Main public static void main(String[] args) {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    } main {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    } long num num x x sum=0; sum 0 Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) num = scanner.nextLong() num scanner.nextLong() scanner.nextLong scanner x = scanner.nextLong() x scanner.nextLong() scanner.nextLong scanner for(int i=0; i<x; i++) sum += scanner.nextLong(); int i=0; int i=0; i 0 i<x i x i++ i++ i sum += scanner.nextLong(); sum += scanner.nextLong() sum scanner.nextLong() scanner.nextLong scanner if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum); sum > num sum num {
            System.out.println(-1);
        } System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(num - sum) System.out.println System.out System System.out num - sum num sum String[] args args public class Main {

    public static void main(String[] args) {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    }
} public class Main {

    public static void main(String[] args) {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    }
} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        long num, x, sum=0;
        Scanner scanner = new Scanner(System.in);
        num = scanner.nextLong();
        x = scanner.nextLong();
        //scanner.nextLine();
        for(int i=0; i<x; i++) sum += scanner.nextLong();
        if(sum > num){
            System.out.println(-1);
        }
        else System.out.println(num - sum);
    }
}