/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author yoovraj.shinde
 */
public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    }

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    }

} Main public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    } main {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    } Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in))); in new Scanner(new BufferedReader(new InputStreamReader(System.in))) String s  = in.nextLine(); s in.nextLine() in.nextLine in int n = Integer.parseInt(s.split(" ")[0]); n Integer.parseInt(s.split(" ")[0]) Integer.parseInt Integer s.split(" ")[0] s.split(" ") s.split s " " 0 int act = 0; act 0 String tasks = in.nextLine(); tasks in.nextLine() in.nextLine in for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        } String t tasks.split(" ") tasks.split tasks " " {
            act = act + Integer.parseInt(t);
        } {
            act = act + Integer.parseInt(t);
        } act = act + Integer.parseInt(t) act act + Integer.parseInt(t) act Integer.parseInt(t) Integer.parseInt Integer t int res = n - act; res n - act n act if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        } res < 0 res 0 {
            System.out.println("-1");
        } System.out.println("-1") System.out.println System.out System System.out "-1" {
            System.out.println(res);
        } System.out.println(res) System.out.println System.out System System.out res String[] args args public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    }

} public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    }

} Main
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;

/**
 *
 * @author yoovraj.shinde
 */
public class Main {
    public static void main(String[] args) {
    //        if (true) return;
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        String s  = in.nextLine();
        int n = Integer.parseInt(s.split(" ")[0]);
        int act = 0;
        String tasks = in.nextLine();
        for (String t : tasks.split(" ")) {
            act = act + Integer.parseInt(t);
        }
        int res = n - act;
        if (res < 0) {
            System.out.println("-1");
        } else {
            System.out.println(res);
        }
        
    }

}
