import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    }
} import java.util.*; util.* java import java.lang.*; lang.* java import java.io.*; io.* java public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    }
} Main public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    } main {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int n = in.nextInt(); n in.nextInt() in.nextInt in int m = in.nextInt(); m in.nextInt() in.nextInt in int sum = 0; sum 0 for(int i =0; i< m; i++)
         sum += in.nextInt(); int i =0; int i =0; i 0 i< m i m i++ i++ i sum += in.nextInt(); sum += in.nextInt() sum in.nextInt() in.nextInt in int re = n- sum; re n- sum n sum if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      } re<0 re 0 {
        System.out.println(-1);
      } System.out.println(-1) System.out.println System.out System System.out -1 1 {
       System.out.println(re);
      } System.out.println(re) System.out.println System.out System System.out re String[] args args public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    }
} public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    }
} Main
import java.util.*;
import java.lang.*;
import java.io.*;

public final class Main
{
    public static void main (String[] args) throws java.lang.Exception {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
      int m = in.nextInt();
       int sum = 0;
      for(int i =0; i< m; i++)
         sum += in.nextInt();
      int re = n- sum;
      if(re<0){
        System.out.println(-1);
      }else {
       System.out.println(re);
      }
    }
}