Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

J. Renovation

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputThe mayor of the Berland city S sees the beauty differently than other city-dwellers. In particular, he does not understand at all, how antique houses can be nice-looking. So the mayor wants to demolish all ancient buildings in the city.

The city S is going to host the football championship very soon. In order to make the city beautiful, every month the Berland government provides mayor a money tranche. The money has to be spent on ancient buildings renovation.

There are *n* months before the championship and the *i*-th month tranche equals to *a*_{i} burles. The city S has *m* antique buildings and the renovation cost of the *j*-th building is *b*_{j} burles.

The mayor has his own plans for spending the money. As he doesn't like antique buildings he wants to demolish as much of them as possible. For the *j*-th building he calculated its demolishing cost *p*_{j}.

The mayor decided to act according to the following plan.

Each month he chooses several (possibly zero) of *m* buildings to demolish in such a way that renovation cost of each of them separately is not greater than the money tranche *a*_{i} of this month (*b*_{j} ≤ *a*_{i}) — it will allow to deceive city-dwellers that exactly this building will be renovated.

Then the mayor has to demolish all selected buildings during the current month as otherwise the dwellers will realize the deception and the plan will fail. Definitely the total demolishing cost can not exceed amount of money the mayor currently has. The mayor is not obliged to spend all the money on demolishing. If some money is left, the mayor puts it to the bank account and can use it in any subsequent month. Moreover, at any month he may choose not to demolish any buildings at all (in this case all the tranche will remain untouched and will be saved in the bank).

Your task is to calculate the maximal number of buildings the mayor can demolish.

Input

The first line of the input contains two integers *n* and *m* (1 ≤ *n*, *m* ≤ 100 000) — the number of months before the championship and the number of ancient buildings in the city S.

The second line contains *n* integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{9}), where *a*_{i} is the tranche of the *i*-th month.

The third line contains *m* integers *b*_{1}, *b*_{2}, ..., *b*_{m} (1 ≤ *b*_{j} ≤ 10^{9}), where *b*_{j} is renovation cost of the *j*-th building.

The fourth line contains *m* integers *p*_{1}, *p*_{2}, ..., *p*_{m} (1 ≤ *p*_{j} ≤ 10^{9}), where *p*_{j} is the demolishing cost of the *j*-th building.

Output

Output single integer — the maximal number of buildings the mayor can demolish.

Examples

Input

2 3

2 4

6 2 3

1 3 2

Output

2

Input

3 5

5 3 1

5 2 9 1 10

4 2 1 3 10

Output

3

Input

5 6

6 3 2 4 3

3 6 4 5 4 2

1 4 3 2 5 3

Output

6

Note

In the third example the mayor acts as follows.

In the first month he obtains 6 burles tranche and demolishes buildings #2 (renovation cost 6, demolishing cost 4) and #4 (renovation cost 5, demolishing cost 2). He spends all the money on it.

After getting the second month tranche of 3 burles, the mayor selects only building #1 (renovation cost 3, demolishing cost 1) for demolishing. As a result, he saves 2 burles for the next months.

In the third month he gets 2 burle tranche, but decides not to demolish any buildings at all. As a result, he has 2 + 2 = 4 burles in the bank.

This reserve will be spent on the fourth month together with the 4-th tranche for demolishing of houses #3 and #5 (renovation cost is 4 for each, demolishing costs are 3 and 5 correspondingly). After this month his budget is empty.

Finally, after getting the last tranche of 3 burles, the mayor demolishes building #6 (renovation cost 2, demolishing cost 3).

As it can be seen, he demolished all 6 buildings.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/23/2018 02:38:56 (d2).

Desktop version, switch to mobile version.

User lists

Name |
---|