import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int[] scores = new int[n + 1]; scores[0] = Integer.MIN_VALUE; scores[n] = Integer.MAX_VALUE / 2; for (int i = 1; i < n; i++) { scores[i] = sc.nextInt(); } Arrays.sort(scores); int left = 0; int right = n; while (right - left > 1) { int x = (left + right) / 2; int idx = 1; int count = 0; for (int i = n - 1; i > idx; i--) { if (i == x) { continue; } while (scores[i] + scores[idx] <= scores[x] + k || idx == x) { idx++; } if (idx < i) { count++; idx++; } } if (count < m) { right = x; } else { left = x; } } if (right == n) { System.out.println(-1); } else { System.out.println(scores[right]); } } }