Problem F. Fired or not?

Author:И. Блинов   Time limit:1 sec
Input file:Standard input   Memory limit:512 Mb
Output file:Standard output  

Statement

At the moment, there are n people waiting in line for a bus. The inspector is in position k in the queue and must leave immediately!

Fortunately, there are b buses available, where the i-th bus can hold ci passengers excluding the driver. All people in the line have a driver’s license, meaning any of them can be hired to fill a driver's seat. The skill level of the j-th person is pj, indicating that they can drive a bus with a capacity of at most pj. All hired drivers leave the line and take the driver's seat in the buses. Hiring the inspector is not allowed, as it would look suspicious.

What is the minimum number of drivers from the line that must be hired to ensure the inspector departs immediately?

Input format

The first line contains two integers, n and k.

The second line contains n integers, pj.

The third line contains a single integer, b.

The fourth line contains b integers, ci.

Output format

Output a single integer: the minimum number of drivers that must be hired so the inspector can leave immediately. If this is impossible, output "-1".

Constraints

1 ≤ n, b ≤ 100000 1 ≤ pi, ci ≤ 100000

Sample tests

No. Standard input Standard output
1
5 5
1 2 3 4 0
5
1 1 1 1 2
2
2
6 1
1 1 1 1 1 1
1
1
1
3
10 7
1 2 1 1 2 1 0 1 2 3
3
3 2 1
3
4
10 8
1 1 1 1 1 1 1 0 1 1
4
1 1 1 1
4
5
2 2
100 100
2
101 101
-1

0.087s 0.010s 13