URI Online Judge | 2065
# Supermarket Line

**Timelimit: 1**

By Cristhian Bonilha, UTFPR Brazil

Today is the inauguration of a huge supermarket in your town, and everyone are excited about the low prices promised.

This supermarket has **N** cashiers, identified by numbers from 1 to **N**, where each cashier takes a specific amount of time **v _{i}** to process an item from a client. Therefore, if a client has

When a client enters the line to be attended he waits until a cashier is free. If more than one cashier are free at the same time, he will be attended by the cashier with the lowest identification number. This cashier will only be free again when he finishes processing all of the clients items.

There are **M** clients on the line to be attended, each with a specific number of items on his basket. Given the information about the cashiers and the clients, the manager asked your help to find out how long it will take so all the clients are attended.

The first line of input has two integers **N** and **M**, indicating the number of cashiers and clients, respectively (1 ≤ **N** ≤ **M** ≤ 10^{4}).

Following there will be **N** integers **v _{i}**, indicating how long the

Following there will be **M** integers **c _{j}**, indicating how many items the

Print a line containing an integer, indicating how long it will take so all the clients are attended.

Input Samples | Output Samples |

1 1 |
18 |

1 2 |
8 |

2 3 |
13 |