import java.util.Scanner;
public 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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       System.out.println(-1);
     }
  }
} import java.util.Scanner; Scanner java.util public 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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    } int i=0; int i=0; i 0 i<M i M i++ i++ i {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    } {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc N-=A[i] N A[i] A i if(N>=0) {
        continue;
      } else {
        break;
      } N>=0 N 0 {
        continue;
      } continue; {
        break;
      } break; if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       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 if(N<0) {
       System.out.println(-1);
     } N<0 N 0 {
       System.out.println(-1);
     } System.out.println(-1) System.out.println System.out System System.out -1 1 String[] args args public 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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       System.out.println(-1);
     }
  }
} public 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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       System.out.println(-1);
     }
  }
} Main
import java.util.Scanner;
public 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 i=0; i<M; i++) {
      A[i] = sc.nextInt();
      N-=A[i];
      if(N>=0) {
        continue;
      } else {
        break;
      }
    }
     if(N>=0) {
       System.out.println(N);
     } else if(N<0) {
       System.out.println(-1);
     }
  }
}