#include <iostream>
#include <vector>
int n, k;
std::vector<std::vector<int>> wines;
int solve()
{
int best = 2020;
for (int i = 0; i < n; ++i)
{
for(int j = 0; j < n - i; ++j)
{
const int cost = i + j*(i + 1);
const auto& row = wines[j + i];
if (cost < k && row[i] < best)
best = row[i];
}
}
return best;
}
int main()
{
std::ios::sync_with_stdio(false);
std::cin >> n >> k;
wines.resize(n);
for (int i = 0; i < n; ++i)
{
wines[i].resize(i + 1);
for (auto& j : wines[i])
std::cin >> j;
}
std::cout << solve() << std::endl;
return 0;
}