import java.util.Scanner;
/**
 * Write a description of class Homework here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class Main
{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int vacation = sc.nextInt();
        
        int assignments = sc.nextInt();
        
        int sum = 0;
        for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        }
        
        if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        }

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

    }
} Main public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int vacation = sc.nextInt();
        
        int assignments = sc.nextInt();
        
        int sum = 0;
        for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        }
        
        if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        }

    } main {
        Scanner sc = new Scanner(System.in);
        
        int vacation = sc.nextInt();
        
        int assignments = sc.nextInt();
        
        int sum = 0;
        for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        }
        
        if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int vacation = sc.nextInt(); vacation sc.nextInt() sc.nextInt sc int assignments = sc.nextInt(); assignments sc.nextInt() sc.nextInt sc int sum = 0; sum 0 for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        } int i = 0; int i = 0; i 0 i < assignments i assignments i++ i++ i {
            int assign = sc.nextInt();
            
            sum += assign;
            
        } {
            int assign = sc.nextInt();
            
            sum += assign;
            
        } int assign = sc.nextInt(); assign sc.nextInt() sc.nextInt sc sum += assign sum assign if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        } sum > vacation sum vacation {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(vacation - sum);
        } System.out.println(vacation - sum) System.out.println System.out System System.out vacation - sum vacation sum String args[] args public class Main
{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int vacation = sc.nextInt();
        
        int assignments = sc.nextInt();
        
        int sum = 0;
        for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        }
        
        if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        }

    }
} public class Main
{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int vacation = sc.nextInt();
        
        int assignments = sc.nextInt();
        
        int sum = 0;
        for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        }
        
        if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        }

    }
} Main
import java.util.Scanner;
/**
 * Write a description of class Homework here.
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class Main
{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        
        int vacation = sc.nextInt();
        
        int assignments = sc.nextInt();
        
        int sum = 0;
        for(int i = 0; i < assignments; i++){
            int assign = sc.nextInt();
            
            sum += assign;
            
        }
        
        if(sum > vacation) {
            System.out.println("-1");
        } else {
            System.out.println(vacation - sum);
        }

    }
}