Submit solution


Points: 10
Time limit: 1.0s
Memory limit: 256M

Problem types

Aslı has \(\mathbf{N}\) friends in total. One day, all of Aslı's friends sell out him/her and go to the theater. All of them have hats and they leave their hats at the hanger in the entrance. However because they have sold out Aslı, they have been cursed. So a fire breaks out in the theater and they should evacuate theater quickly. Everyone takes a random hat that happens to fit them and leaves the theater.

Everyone can wear a hat which is greater than or equal to the size of their own hat. The hanger holds \(\mathbf{K}\) different sizes of hats. People who can find a hat fits them, quickly exits the theater. If there's someone who can't find a hat, sadly he or she cannot escape the fire.

Can you find how many ways all of the Aslı's friends can escape the theater?

Input

First line consists of integers \(\mathbf{N}\) and \(\mathbf{K}\).

Second line consists of \(\mathbf{N}\) integers which form the list \(\mathbf{a_1, a_2, ... ,a_n}\). Every integer \(\mathbf{a_i}\) shows the size of the hat \(i^{th}\) person wears.

Third line consists of \(\mathbf{K}\) integers which form the list \(\mathbf{b_1, b_2, ... ,b_n}\). Every integer \(\mathbf{b_i}\) shows how many hats there are in the hanger of size \(i\).

Batch #1:
  • \(1 \leq \mathbf{N, K} \leq 100\)
  • \(1 \leq \mathbf{a_i, b_i} \leq 100\)
Batch #2:
  • \(1 \leq \mathbf{N, K} \leq 10^5\)
  • \(1 \leq \mathbf{a_i, b_i} \leq 10^{5}\)

Output

Print one integer, the number of ways Aslı's friends can escape the theater. Since this number can be big, you take the mod with \(10^9+7\) before printing it.

Samples

Input:

2 3
3 2
7 4 2

Output:

10

Input:

5 3
1 2 3 1 2
3 3 3

Output:

1800

Explanation

1. Input
  • Aslı has 2 friends in total and they wear hats of size 3 and 2.
  • There are 3 different sizes of hats on the hanger. There are 7 hats of size 1, 4 hats of size 2 and 2 hats of size 3.