import java.util.*;

class Main{
    public static void main(String args[]){
         Scanner S =  new Scanner(System.in);
         int N = Integer.parseInt(S.next());
         int M = Integer.parseInt(S.next());
         int total = 0;
         for(int i=0;i<M;i++){
             total += Integer.parseInt(S.next());
         }

         if(N >= total){
             System.out.println(N-total);
         } else {
             System.out.println(-1);
         }

    }
} import java.util.*; util.* java class Main{
    public static void main(String args[]){
         Scanner S =  new Scanner(System.in);
         int N = Integer.parseInt(S.next());
         int M = Integer.parseInt(S.next());
         int total = 0;
         for(int i=0;i<M;i++){
             total += Integer.parseInt(S.next());
         }

         if(N >= total){
             System.out.println(N-total);
         } else {
             System.out.println(-1);
         }

    }
} Main public static void main(String args[]){
         Scanner S =  new Scanner(System.in);
         int N = Integer.parseInt(S.next());
         int M = Integer.parseInt(S.next());
         int total = 0;
         for(int i=0;i<M;i++){
             total += Integer.parseInt(S.next());
         }

         if(N >= total){
             System.out.println(N-total);
         } else {
             System.out.println(-1);
         }

    } main {
         Scanner S =  new Scanner(System.in);
         int N = Integer.parseInt(S.next());
         int M = Integer.parseInt(S.next());
         int total = 0;
         for(int i=0;i<M;i++){
             total += Integer.parseInt(S.next());
         }

         if(N >= total){
             System.out.println(N-total);
         } else {
             System.out.println(-1);
         }

    } Scanner S =  new Scanner(System.in); S new Scanner(System.in) int N = Integer.parseInt(S.next()); N Integer.parseInt(S.next()) Integer.parseInt Integer S.next() S.next S int M = Integer.parseInt(S.next()); M Integer.parseInt(S.next()) Integer.parseInt Integer S.next() S.next S int total = 0; total 0 for(int i=0;i<M;i++){
             total += Integer.parseInt(S.next());
         } int i=0; int i=0; i 0 i<M i M i++ i++ i {
             total += Integer.parseInt(S.next());
         } {
             total += Integer.parseInt(S.next());
         } total += Integer.parseInt(S.next()) total Integer.parseInt(S.next()) Integer.parseInt Integer S.next() S.next S if(N >= total){
             System.out.println(N-total);
         } else {
             System.out.println(-1);
         } N >= total N total {
             System.out.println(N-total);
         } System.out.println(N-total) System.out.println System.out System System.out N-total N total {
             System.out.println(-1);
         } System.out.println(-1) System.out.println System.out System System.out -1 1 String args[] args
import java.util.*;

class Main{
    public static void main(String args[]){
         Scanner S =  new Scanner(System.in);
         int N = Integer.parseInt(S.next());
         int M = Integer.parseInt(S.next());
         int total = 0;
         for(int i=0;i<M;i++){
             total += Integer.parseInt(S.next());
         }

         if(N >= total){
             System.out.println(N-total);
         } else {
             System.out.println(-1);
         }

    }
}
