1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include<bits/stdc++.h>
using namespace std;

const int N = 1000 * 1000 + 7;
int tree[2*N];
int n, k, a, ans = 2020, rozmiar = 1, jump = 2, level = 1;

int main() {
	
	ios_base::sync_with_stdio(0);
	cin >> a >> k;
	
	n = (a*(a+1))/2;
	for(int i = 1; i <= n; i++) cin >> tree[i];
	
	for(int i = 1; i <= n; i++) {
		if(i > rozmiar) rozmiar += jump, level++, jump++;
		int P = rozmiar - i + 1;
		int L = level - P + 1;
		if(L * P <= k) ans = min(ans, tree[i]);
	}
	cout << ans;
	return 0;
}