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