hiho#1133: two points • Two points to find the K decimal

Source: Internet
Author: User

#1133: Two minutes • Two points find K decimal time limit:10000msSingle Point time limit:1000msMemory Limit:256MB
Describe

In the last time we know nettle playing "warship これ", nettle of the garrison has a lot of position, but more is limited. Nettle through the fishing boat and out of a rare ship, but the existing N (1≤n≤1,000,000) has a ship. So nettle had to tear down one of the ships to give way to the new boat. Nettle thought for a long time, decided to randomly select a K, and then remove the rare K small ship. Each ship is known to have its own rarity, and nettle now tells you the rarity of all the ships, hoping you can help him find the target ship.

Hint: Two-part lookup of a non-ordered array

Input

Line 1th: 2 integer n,k. n indicates the length of the array,
Line 2nd: N integers, representing A[1..N], guaranteed not to have duplicate numbers, 1≤a[i]≤2,000,000,000.

Output

Line 1th: an integer t, which indicates that T is a small number of k in the array, and if K is not in the array, output-1.

Sample input
10 41732 4176 2602 6176 1303 6207 3125 1 1011 6600
Sample output
1732
Sort sorted just look test instructions want me to write a quick line?????




hiho#1133: two points • Two points to find the K decimal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.