Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/minmax-14-b-dan-katta-eng-kichik-son

Smallest number greater than B

Easy 1000 ms 256 MB 30%
Share

A positive integer $N$, an integer $B$ and $N$ integers are given. Among the numbers greater than $B$, find the smallest one and the position of its first occurrence (if there is no such number, print 0 0).

Finding the smallest among the elements greater than a given number

Input

The first line contains two integers: $N$ and $B$. The next line contains $N$ integers $A_{i}$.

Output

One line with two integers separated by a space: the smallest number greater than $B$ and its position (if there is none — 0 0).

Note

$1 \le N \le 1000$
$-10^{9} \le B \le 10^{9}$
$-10^{9} \le A_{i} \le 10^{9}$

Examples

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

Sign in to submit a solution

Signing up is free and takes a minute.