#K84002. Minimum Additional Seats

    ID: 36322 Type: Default 1000ms 256MiB

Minimum Additional Seats

Minimum Additional Seats

You are given C courses and a total of S students registered across these courses. For each course i (with 0 ≤ i < C), there are Ni students registered and an initial capacity of Mi seats available.

If the number of registered students exceeds the current capacity in any course, additional seats are needed so that every student can be accommodated. Formally, for each course i, if Ni > Mi, then the extra seats required is Ni - Mi. The task is to calculate the total minimum number of additional seats required, i.e., $$ additional = \sum_{i=0}^{C-1} \max\{0, N_{i} - M_{i}\}.$$

Note that the parameter S represents the total number of students registered across courses. It is provided as part of the input but is not directly used in calculating the additional seats required.

inputFormat

The input consists of three lines:

  1. The first line contains two integers separated by a space: C (the number of courses) and S (the total number of students registered).
  2. The second line contains C integers: N0, N1, ..., NC-1, where each Ni is the number of students registered for course i.
  3. The third line contains C integers: M0, M1, ..., MC-1, where each Mi is the current seating capacity for course i.

outputFormat

Output a single integer, which is the minimum number of additional seats required so that every student can be allocated a seat in their registered course.

## sample
3 13
4 5 4
5 5 10
0