import java.util.Scanner;

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

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