import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	}
} import java.util.*; util.* java public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	} main {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) String line = sc.nextLine(); line sc.nextLine() sc.nextLine sc String num = sc.nextLine(); num sc.nextLine() sc.nextLine sc String[] data = line.split(" "); data line.split(" ") line.split line " " String[] num2 = num.split(" "); num2 num.split(" ") num.split num " " Integer sum = 0; sum 0 for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        } int i = 0; int i = 0; i 0 i < Integer.parseInt(data[1]) i Integer.parseInt(data[1]) Integer.parseInt Integer data[1] data 1 i++ i++ i {
          sum += Integer.parseInt(num2[i]);
        } {
          sum += Integer.parseInt(num2[i]);
        } sum += Integer.parseInt(num2[i]) sum Integer.parseInt(num2[i]) Integer.parseInt Integer num2[i] num2 i Integer nokori = Integer.parseInt(data[0]) - sum; nokori Integer.parseInt(data[0]) - sum Integer.parseInt(data[0]) Integer.parseInt Integer data[0] data 0 sum if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      } nokori < 0 nokori 0 {
        System.out.println(-1);
      } System.out.println(-1) System.out.println System.out System System.out -1 1 {
        System.out.println(nokori);
      } System.out.println(nokori) System.out.println System.out System System.out nokori String[] args args public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	}
} public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	}
} Main
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String line = sc.nextLine();
      	String num = sc.nextLine();
		String[] data = line.split(" ");
      	String[] num2 = num.split(" ");
      	Integer sum = 0;
      	for(int i = 0; i < Integer.parseInt(data[1]); i++){
          sum += Integer.parseInt(num2[i]);
        }
		Integer nokori = Integer.parseInt(data[0]) - sum;
      if(nokori < 0){
        System.out.println(-1);
      }else{
        System.out.println(nokori);
      }
	}
}