M. Kubernetes
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Kubernetes is a container orchestration system for automating software deployments, and google wants your help to maintain a highly available Kubernetes cluster.

A Kubernetes cluster is a group of $$$N$$$ nodes (machines) that are used to run applications, each node has a capacity of $$$c_i$$$ pods (a pod is an instance of an application).

We have $$$M$$$ applications and each application has a number of pods $$$a_j$$$ that needs to be run on the cluster to make sure that its users have a nice experience, for example a widely used application like google search must have a lot of instances running, while another small application like google keep doesn't need that much instances to keep users happy.

We define for each application a value called $$$availability_j$$$ which is equal to the minimum number of pods from the application $$$j$$$ running on the same node after distrubution for example:

Here we have 3 nodes with capacities $$$5,4,5$$$ respectively and 3 applications:

  1. Application 1: 7 pods (1 to 7) with availability of 2 (node 2 is only running 2 pods from this application)
  2. Application 2: 5 pods (8 to 12) with availability of 1 (all nodes are running 2 pods from this application except for node 2)
  3. Application 3: 1 pod (pod 13) with availabilito of 0 (there is only one pod in node 3 so nodes 1 and 2 have zero pods running from this application)

Now your job is determine the maximum possible value for $$$\min_{1 \le j \le M}(availability_j)$$$

Note: Its guaranteed that all applications can be deployed in the cluster

Input

The first line of the input contains $$$N$$$ and $$$M$$$ ($$$1 \le N,M \le 10^5$$$) the number of nodes, and the number of applications respectively.

The second line of the input contains $$$N$$$ integer representing the capacity of each node ($$$1 \le c_i \le 10^9$$$)

The third line of the input contains $$$M$$$ integer representing the number of pods ($$$1 \le a_j \le 10^9$$$)

Its guaranteed that $$$\sum_{j=1}^{j=M}{a_j} \le \sum_{i=1}^{i=N}{c_i}$$$

Output

Print one integer that represents the maximum possible value for $$$\min_{1 \le j \le M}(availability_j)$$$

Examples
Input
3 3
5 4 5
7 5 1
Output
0
Input
4 3
9 9 8 9
8 10 10
Output
2