import java.util.*;
 public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

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

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

      for(int i = 0;i < a.length;i++){
         N -= a[i];
      }
         if(N >= 0){
            System.out.println(N);
         }else{
            System.out.println(-1);
         }
      
         
   }
 } Main public static void main(String[] args){
      Scanner sc = new Scanner(System.in);

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

      for(int i = 0;i < a.length;i++){
         N -= a[i];
      }
         if(N >= 0){
            System.out.println(N);
         }else{
            System.out.println(-1);
         }
      
         
   } main {
      Scanner sc = new Scanner(System.in);

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

      for(int i = 0;i < a.length;i++){
         N -= a[i];
      }
         if(N >= 0){
            System.out.println(N);
         }else{
            System.out.println(-1);
         }
      
         
   } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int[] a = new int[M]; a new int[M] M for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      } int i = 0; int i = 0; i 0 i < M i M i++ i++ i {
        a[i] = sc.nextInt();
      } {
        a[i] = sc.nextInt();
      } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc for(int i = 0;i < a.length;i++){
         N -= a[i];
      } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
         N -= a[i];
      } {
         N -= a[i];
      } N -= a[i] N a[i] a i if(N >= 0){
            System.out.println(N);
         }else{
            System.out.println(-1);
         } N >= 0 N 0 {
            System.out.println(N);
         } System.out.println(N) System.out.println System.out System System.out N {
            System.out.println(-1);
         } System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

      for(int i = 0;i < a.length;i++){
         N -= a[i];
      }
         if(N >= 0){
            System.out.println(N);
         }else{
            System.out.println(-1);
         }
      
         
   }
 } public class Main {
	public static void main(String[] args){
      Scanner sc = new Scanner(System.in);

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

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

      int N = sc.nextInt();
      int M = sc.nextInt();
      int[] a = new int[M];
      

      for(int i = 0;i < M;i++){
        a[i] = sc.nextInt();
      }

      for(int i = 0;i < a.length;i++){
         N -= a[i];
      }
         if(N >= 0){
            System.out.println(N);
         }else{
            System.out.println(-1);
         }
      
         
   }
 }
