import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] A = new int[M];
    for(int n = 0; n < M; n++) {
        A[n] = sc.nextInt();
        N = N - A[n];
    }

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

    if(N >= 0) {
      System.out.println(N);
    } else {
      System.out.println("-1");
    }
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] A = new int[M];
    for(int n = 0; n < M; n++) {
        A[n] = sc.nextInt();
        N = N - A[n];
    }

    if(N >= 0) {
      System.out.println(N);
    } else {
      System.out.println("-1");
    }
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] A = new int[M];
    for(int n = 0; n < M; n++) {
        A[n] = sc.nextInt();
        N = N - A[n];
    }

    if(N >= 0) {
      System.out.println(N);
    } else {
      System.out.println("-1");
    }
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int M = sc.nextInt(); M sc.nextInt() sc.nextInt sc int[] A = new int[M]; A new int[M] M for(int n = 0; n < M; n++) {
        A[n] = sc.nextInt();
        N = N - A[n];
    } int n = 0; int n = 0; n 0 n < M n M n++ n++ n {
        A[n] = sc.nextInt();
        N = N - A[n];
    } {
        A[n] = sc.nextInt();
        N = N - A[n];
    } A[n] = sc.nextInt() A[n] A n sc.nextInt() sc.nextInt sc N = N - A[n] N N - A[n] N A[n] A n if(N >= 0) {
      System.out.println(N);
    } else {
      System.out.println("-1");
    } N >= 0 N 0 {
      System.out.println(N);
    } System.out.println(N) System.out.println System.out System System.out N {
      System.out.println("-1");
    } System.out.println("-1") System.out.println System.out System System.out "-1" String[] args args
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int M = sc.nextInt();
    int[] A = new int[M];
    for(int n = 0; n < M; n++) {
        A[n] = sc.nextInt();
        N = N - A[n];
    }

    if(N >= 0) {
      System.out.println(N);
    } else {
      System.out.println("-1");
    }
  }
}