First Value Greater Than X

PHP Medium 5 views
Back to Questions

Problem Description

Given n numbers and x, print the first number that is > x. If none, print -1.

Input Format

Line1 n x. Line2 n integers.

Output Format

One integer.

Sample Test Case

Input:
5 3 1 3 2 8 5
Output:
8

Constraints

n

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next