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