import java.util.*;
import java.io.*;
public class Main
{
  public static void main(String args[])throws Exception
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  }
} import java.util.*; util.* java import java.io.*; io.* java public class Main
{
  public static void main(String args[])throws Exception
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  }
} Main public static void main(String args[])throws Exception
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  } main {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  } BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) PrintWriter pw=new PrintWriter(System.out); pw new PrintWriter(System.out) String str[]=br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int n=Integer.parseInt(str[0]); n Integer.parseInt(str[0]) Integer.parseInt Integer str[0] str 0 int m=Integer.parseInt(str[1]); m Integer.parseInt(str[1]) Integer.parseInt Integer str[1] str 1 int hw=0; hw 0 str=br.readLine().split(" ") str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]); int i=0; int i=0; i 0 i<m i m i++ i++ i hw+=Integer.parseInt(str[i]); hw+=Integer.parseInt(str[i]) hw Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw); hw>n hw n pw.println(-1) pw.println pw -1 1 pw.println(n-hw) pw.println pw n-hw n hw pw.flush() pw.flush pw pw.close() pw.close pw String args[] args public class Main
{
  public static void main(String args[])throws Exception
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  }
} public class Main
{
  public static void main(String args[])throws Exception
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  }
} Main
import java.util.*;
import java.io.*;
public class Main
{
  public static void main(String args[])throws Exception
  {
    BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    PrintWriter pw=new PrintWriter(System.out);
    String str[]=br.readLine().split(" ");
    int n=Integer.parseInt(str[0]);
    int m=Integer.parseInt(str[1]);
    int hw=0;
    str=br.readLine().split(" ");
    for(int i=0;i<m;i++)
    hw+=Integer.parseInt(str[i]);
    if(hw>n)
    pw.println(-1);
    else
    pw.println(n-hw);
    pw.flush();
    pw.close();
  }
}