You are given a sequence of integers of length nn and integer number kk . You should print any integer number xx in the range of [1;109][1;109] (i.e. 1≤x≤1091≤x≤109 ) such that exactly kk elements of given sequence are less than or equal to xx .

Note that the sequence can contain equal elements.

If there is no such xx , print "-1" (without quotes).

Input

The first line of the input contains integer numbers nn and kk (1≤n≤2⋅1051≤n≤2⋅105 , 0≤k≤n0≤k≤n ). The second line of the input contains nn integer numbers a1,a2,…,ana1,a2,…,an (1≤ai≤1091≤ai≤109 ) — the sequence itself.

Output

Print any integer number xx from range [1;109][1;109] such that exactly kk elements of given sequence is less or equal to xx .

If there is no such xx , print "-1" (without quotes).

Examples

Input

7 4
3 7 5 1 10 3 20

Output

6

Input

7 2
3 7 5 1 10 3 20

Output

-1

Note

In the first example 55 is also a valid answer because the elements with indices [1,3,4,6][1,3,4,6] is less than or equal to 55 and obviously less than or equal to 66 .

In the second example you cannot choose any number that only 22 elements of the given sequence will be less than or equal to this number because 33 elements of the given sequence will be also less than or equal to this number.

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<iostream>
using namespace std;
int main()
{long long x,n,k,a[200000];scanf("%lld%lld",&n,&k);long long i;for(i=0;i<n;i++){scanf("%lld",&a[i]);}sort(a,a+n);if(k==0)     ///之前没有考虑K为0的情况。{long long b=a[0]-1>=1?a[0]-1:-1;  ///因为X要为正整数。printf("%lld\n",b);}else{if(a[k-1]==a[k]){printf("-1\n");}else{long long t=a[k-1];printf("%lld\n",t);}}
}

Trainning 1 DAY相关推荐

  1. [人工智能-深度学习-46]:FineTuning(微调)、Transfer Trainning(迁移学习)的理论基础与深度解析

    作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客 本文网址:https://blog.csdn.net/HiWangWenBing/article/detai ...

  2. Augustus指南(Trainning部分)

    目录 Augustus指南 官方 Tutorial Index Input: Trainning: Prediction Output: 可能用到的其他软件 Trainning Augustus 1. ...

  3. model trainning 模型训练

    学习笔记 模型的理解,构建.神经网络的训练 使用封闭方程来求解,获得模型在当前训练集上最优的参数==>在训练集上使得损失函数达到最小值时模型的参数 使用迭代优化的方法,梯度下降(GD),在训练集 ...

  4. on device trainning

    1. On-Device Training with TensorFlow Litehttps://tensorflow.google.cn/lite/examples/on_device_train ...

  5. EMC trainning杂谈

    EMC: 中国了解EMC从认证入手.买到欧盟要强制符合EMC标准,上升到法律标准.中国有3C 标准,但在很多行业不是强制性的 .大学很少搞EMC,以前. EMC产生的原因?产生问题,所以要解决问题,所 ...

  6. trainning 2017-11-21

  7. ruby trainning - decryption

    2019独角兽企业重金招聘Python工程师标准>>> #author linxu #decrypt the message of cipher.txt module RubyTra ...

  8. ssis trainning

    1. 防止包打开后hang住,可以使用delay validation=false. 2.2008R2 configuration 起作用的优先级? 一是des ign time. 二是运行的时候指定 ...

  9. android trainning(4)

    一.使用剪贴板在activity间传递信息 public class MainActivity extends Activity {EditText text;@Overrideprotected v ...

最新文章

  1. C/Cpp / 类的前向声明、不完全类型和完全类型
  2. Resharper 5.0 注册码
  3. 论文原文解读汇总(持续更新中)
  4. uos20专业版是linux哪个版本,WPS Office 2019 for Linux 专业版已与统一操作系统 UOS 完成适配...
  5. webpack自动化构建脚本指令npm run dev/build
  6. IDEA如何删除无用war包
  7. java自动类型转换与强制类型转换
  8. 包含头文件的问题之1.7编程基础之字符串 24:单词的长度
  9. 211.添加与搜索单词-数据结构设计
  10. 182_赵陈雄_java核心编程实验
  11. RGB565 RGB888
  12. linux基础 linux命令跟踪 strace命令
  13. Servlet设置欢迎页面!
  14. 图书信息管理系统(数据结构顺序表,c语言版)
  15. python综合实验心得体会_综合实验心得体会
  16. 一个基于 Python 的简单服务|Tips
  17. 天润云再恢复上市进程:2021年利润下滑七成,称未来业绩增长放缓
  18. 第06讲 连接到MySQL数据库02之jdbc
  19. 北邮计算机学院保研加分细则,北京邮电大学保研经验介绍
  20. [WCF权限控制]利用WCF自定义授权模式提供当前Principal[原理篇]

热门文章

  1. 纯c++实现光线追踪渲染器
  2. “有点笨”的数学大师迈克尔·弗里德曼
  3. 天津科技大学计算机专业,天津科技大学计算机科学与信息工程学院介绍
  4. 8.9 HITTING SET problem
  5. RTX30 系列游戏本与台式机、云服务器显卡 AI 计算力对比
  6. 《统计学习方法(第二版)》学习笔记 第五章 决策树
  7. 能源数字化,未来四十年看什么?
  8. java拼图游戏(带文档资料)
  9. 无法访问此网站 localhost 拒绝了我们的连接请求。
  10. C/C++中CRT表示什么意思?