
import java.util.*;
public class Main{
 
     public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
}} import java.util.*; util.* java public class Main{
 
     public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
}} Main public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
} main {
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int t = sc.nextInt(); t sc.nextInt() sc.nextInt sc int sum =0; sum 0 while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   } t-->0 t-- t 0 {
       int b = sc.nextInt();
       sum+=b;
      
   } int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc sum+=b sum b int r=0; r 0 if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     } a<sum a sum {
       System.out.println(-1);
   } System.out.println(-1) System.out.println System.out System System.out -1 1 {
    r = a-sum;
     System.out.println(r);
     } r = a-sum r a-sum a sum System.out.println(r) System.out.println System.out System System.out r String []args args public class Main{
 
     public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
}} public class Main{
 
     public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
}} Main

import java.util.*;
public class Main{
 
     public static void main(String []args){
   Scanner sc = new Scanner(System.in);
   int a = sc.nextInt();
   int t = sc.nextInt();
   int sum =0;
   while(t-->0){
       int b = sc.nextInt();
       sum+=b;
      
   }
  int r=0;
   if(a<sum){
       System.out.println(-1);
   }else{
    r = a-sum;
     System.out.println(r);
     }
}}