import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  }
} import java.util.Scanner; Scanner java.util public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  }
} Main public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int a a b b d; d a = sc.nextInt() a sc.nextInt() sc.nextInt sc int x[] = new int [a]; x new int [a] a d = 0 d 0 for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    } b =0; b =0 b 0 b < a b a b++ b++ b {
      x[b] = sc.nextInt();
      d = d + x[b];
    } {
      x[b] = sc.nextInt();
      d = d + x[b];
    } x[b] = sc.nextInt() x[b] x b sc.nextInt() sc.nextInt sc d = d + x[b] d d + x[b] d x[b] x b int e = c-d; e c-d c d if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    } e >= 0 e 0 {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
      System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" String[] args args public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  }
} public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  }
} Main
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int c = sc.nextInt();
    int a,b,d;
    a = sc.nextInt();
    int x[] = new int [a];
    d = 0;
    for(b =0;b < a;b++){
      x[b] = sc.nextInt();
      d = d + x[b];
    }
    int e = c-d;
    if(e >= 0){
      System.out.println(e);
    }else{
      System.out.println("-1");
    }
  }
}