F. Felipe the Bandit
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Felipe is a bandit: he has two special lady friends and, every time he goes on a trip, he likes to bring gifts to both. But he has a favorite, and he always gives her the best gifts.

In the store there are $$$n$$$ different gifts, and the $$$i$$$-th costs $$$a_i$$$ Bs. Each gift can be bought only once. On each trip, Felipe buys like this:

  1. For the favorite he spends at most $$$X$$$ Bs. While he can afford the most expensive gift left in the store, he buys it. When he cannot afford the most expensive one left, he stops buying for her.
  2. For the second one he spends at most $$$Y$$$ Bs, among the gifts that are left. While he can afford the cheapest gift left, he buys it. When he cannot afford the cheapest one left, he stops buying for her.

Felipe makes $$$q$$$ trips. Each trip is independent: the store always starts with the $$$n$$$ gifts. For each trip, how many gifts does each of them receive?

Input

The first line contains two integers $$$n$$$ and $$$q$$$: the number of gifts and the number of trips.

The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$: the prices of the gifts.

Each of the following $$$q$$$ lines contains two integers $$$X$$$ and $$$Y$$$: what Felipe is willing to spend on the favorite and on the second one on that trip.

Constraints

  • $$$1 \le n, q \le 10^5$$$
  • $$$1 \le a_i \le 10^4$$$
  • $$$1 \le X, Y \le 10^9$$$
Output

For each trip, print on one line two integers separated by a space: the number of gifts the favorite receives and the number the second one receives.

Examples
Input
5 3
5 1 4 2 3
10 2
5 100
9 3
Output
2 1
1 4
2 2
Input
3 2
7 7 7
20 7
7 14
Output
2 1
1 2
Note

Example 1. On the first trip, Felipe buys the gifts of $$$5$$$ and $$$4$$$ Bs for the favorite and has $$$1$$$ Bs left, which is not enough for the one of $$$3$$$. For the second one, the gifts of $$$1$$$, $$$2$$$ and $$$3$$$ are left: he buys the one of $$$1$$$, and the remaining $$$1$$$ Bs is not enough for the one of $$$2$$$. On the second trip, the favorite receives the one of $$$5$$$ and he spends everything, and for the second one he buys the four that are left for $$$10$$$ Bs. On the third, the favorite receives the ones of $$$5$$$ and $$$4$$$, which add up to exactly $$$9$$$, and the second one the ones of $$$1$$$ and $$$2$$$, which add up to exactly $$$3$$$.

Example 2. On the first trip, the favorite receives two gifts of $$$7$$$ Bs, because a third one would make $$$21 \gt 20$$$, and the second one receives the one that is left.