import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  }
} import java.io.InputStream; InputStream java.io import java.io.PrintStream; PrintStream java.io import java.util.Scanner; Scanner java.util public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  }
} Main public static void main(String[] args) {
    resolve(System.in, System.out);
  } main {
    resolve(System.in, System.out);
  } resolve(System.in, System.out) resolve System.in System System.in System.out System System.out String[] args args static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  } resolve {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  } Scanner sc = new Scanner(is); sc new Scanner(is) int n = Integer.parseInt(sc.next()); n Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int m = Integer.parseInt(sc.next()); m Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc int a[] = new int[m]; a new int[m] m long sum = 0; sum 0 for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    } int i = 0; int i = 0; i 0 i < m i m i++ i++ i {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    } {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    } a[i] = Integer.parseInt(sc.next()) a[i] a i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc sum += a[i] sum a[i] a i pw.println(
      Math.max(n - sum, -1)
    ) pw.println pw Math.max(n - sum, -1) Math.max Math n - sum n sum -1 1 InputStream is is PrintStream pw pw public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  }
} public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  }
} Main
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[m];
    long sum = 0;
    for (int i = 0; i < m; i++) {
      a[i] = Integer.parseInt(sc.next());
      sum += a[i];
    }
    pw.println(
      Math.max(n - sum, -1)
    );
  }
}
