
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    }
} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    }
} Main public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    } main {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int a = scanner.nextInt(); a scanner.nextInt() scanner.nextInt scanner int b = scanner.nextInt(); b scanner.nextInt() scanner.nextInt scanner int[] A = new int[b]; A new int[b] b int sum = 0; sum 0 for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	} int i = 0; int i = 0; i 0 i < b i b i++ i++ i {
		A[i] = scanner.nextInt();
	} {
		A[i] = scanner.nextInt();
	} A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner for(int c : A)
		sum += c; int c A sum += c; sum += c sum c if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum); a - sum < 0 a - sum a sum 0 System.out.println(-1) System.out.println System.out System System.out -1 1 System.out.println(a - sum) System.out.println System.out System System.out a - sum a sum String[] args args public class Main {

    public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    }
} public class Main {

    public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    }
} Main

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
	Scanner scanner = new Scanner(System.in);

	int a = scanner.nextInt();
	int b = scanner.nextInt();

	int[] A = new int[b];

	int sum = 0;

	for(int i = 0; i < b ; i++){
		A[i] = scanner.nextInt();
	}
	for(int c : A)
		sum += c;

	if(a - sum < 0)
		System.out.println(-1);
	else
		System.out.println(a - sum);
    }
}
