import java.util.*;

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

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