1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <climits>

using namespace std;

int main()
{
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);

	int min_year = INT_MAX;
	size_t n, k;
	cin >> n >> k;

	for (size_t i = 1; i <= n; i++)
		for (size_t j = 1; j <= i; j++)
		{
			const size_t min_necessary = (i - j + 1) * j;
			int cur_year;
			cin >> cur_year;
			if (min_year > cur_year && min_necessary <= k)
				min_year = cur_year;
		}

	cout << min_year;
}