import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    }
} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc int a = 0; a 0 for(int i=0;i<m;i++){
            a += sc.nextInt();
        } int i=0; int i=0; i 0 i<m i m i++ i++ i {
            a += sc.nextInt();
        } {
            a += sc.nextInt();
        } a += sc.nextInt() a sc.nextInt() sc.nextInt sc if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        } a > n a n {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(n - a);
        } System.out.println(n - a) System.out.println System.out System System.out n - a n a String[] args args public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    }
} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
       
        // 配列
        int a = 0;
        for(int i=0;i<m;i++){
            a += sc.nextInt();
        }
        
        if(a > n){
            System.out.println("-1");
        } else {
            System.out.println(n - a);
        }
    }
}
