import strutils,sequtils,algorithm var L : seq[int] N,M,Ma,mi,n : int A,A2 : seq[int] k : int I,p,cnt,point,j,index : int A = @[] L = stdin.readline.split.map(parseInt) (N,M) = (L[0],L[1]) I = stdin.readline.parseInt for n in 0.. 0: n = (Ma + mi) div 2 p = A[n] point = I + p A2 = A[0..n-1] & A[n + 1..high(A)] cnt = 0 for i,a in reversed(A2): j = point - a if j <= 0: cnt += A2.len - i - 1 continue index = lowerBound(A2[0..high(A2)-i-1],j + 1) index = A2.len - i - 1 - index if index == 0: break cnt += index if cnt >= M: mi = n + 1 if cnt < M: Ma = n if Ma <= N - 2 and A[mi] == A[Ma]: break if mi > N - 2: echo -1 else: echo A[mi]