AlgoUniversity
  • Go Back
Discussion
Two Sum :

Author

HARSH PRIYADARSHI

Difficulty Level : Easy

Submissions : 746

Asked In : Amazon

Marks :10

: 13 | : 1

You are given an array $$$A$$$ of $$$N$$$ integers and an integer $$$K$$$. You have to find two integers whose sum is equal to K. You can assume that each problem has a unique solution and the solution always exists. You can't use the same integer twice. Output the integers in ascending order.

 

 

Input

 

First line contains two integers N K $$$(2 \le N \le 2 ⋅ 10^5)$$$ - Number of integers in the array, $$$(0 \le K \le 10^9)$$$ - Target value

The next line contains N integers A1, A2, A3 ... An $$$(1 \le Ai \le 10^8)$$$ - Element of the array A.

 

 

Output

 

Two integers from the array A sorted in Ascending Order whose sum is equal to K

 

 

Examples

 

 

Input
5 8
1 2 3 4 5
Output
3 5
Input
5 12
7 3 5 8 1
Output
5 7

 

 

Note

 

Here, we can see that (3+5=8) Therefore answer is 3 5

 

 

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.