Back to the Funk


Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 640M

Author:
Problem type
Allowed languages
Assembly, C, C++, Java, Kotlin, Pascal, Perl, Python, Scratch, Text

Fionn has a time machine, and he's going to take it on a joyride.

He wants to chase the funky vibes of particular cultural, musical, and artistic movements throughout history. Unfortunately, his time machine can only take him to a set of specific years. Can you help him get as close as possible to his destination?

Input

The input consists of several lines.

The first line contains an integer \(1 \leq n \leq 100\) representing the amount of different years Fionn can travel to, and an integer \(0 \leq k \leq 3000\) representing his target destination.

Then, there are \(n\) lines. Each line contains a distinct year \(x_i\), representing a year Fionn can travel to. These years may be listed in any order.

There will never be any ties. There will always be one year \(x_i\) that is strictly the closest to \(k\).

Output

The program must output the year \(x_i\) that is closest to \(k\).

Examples

Example 1

Input:

3 1968
1967
1970
1985

In this example, Fionn wants to travel as close as possible to 1968, and he may travel to 1967, 1970, or 1985.

Output:

1967

The year closest to 1968 in the set is 1967; there is a difference of only one year between the two years.

Example 2
3 1848
1917
1207
1301

Output:

1917
Example 3

Input:

1 2008
2008

Output:

2008

Comments

There are no comments at the moment.