import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    }
} import java.util.HashMap; HashMap java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    } main {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) HashMap<String,Integer> hash = new HashMap<>(); hash new HashMap<>() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int m = sc.nextInt(); m sc.nextInt() sc.nextInt sc long work = 0; work 0 for (int i=0;i<m;i++)work+=sc.nextInt(); int i=0; int i=0; i 0 i<m i m i++ i++ i work+=sc.nextInt(); work+=sc.nextInt() work sc.nextInt() sc.nextInt sc if (n<work)System.out.println(-1);
        else System.out.println(n-work); n<work n work System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(n-work) System.out.println System.out System System.out n-work n work String[] args args public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    }
} Main
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        HashMap<String,Integer> hash = new HashMap<>();
        int n = sc.nextInt();
        int m = sc.nextInt();
        long work = 0;
        for (int i=0;i<m;i++)work+=sc.nextInt();
        if (n<work)System.out.println(-1);
        else System.out.println(n-work);
    }
}
