import java.util.*;

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

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