#include <iostream>
#include <limits>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int max_y, allowable_to_take;
cin >> max_y >> allowable_to_take;
int best_year = std::numeric_limits<int>::max();
for (int y = 1; y <= max_y; ++y) {
for (int x = 1; x <= y; ++x) {
int now;
cin >> now;
int steps_to_take =
y * (y + 1) / 2 - (y - x) * (y - x + 1) / 2 - (x - 1) * x / 2;
// cout << now << " (" << x << ", " << y << "): " << steps_to_take << endl;
if (steps_to_take <= allowable_to_take) {
best_year = std::min(best_year, now);
}
}
}
cout << best_year << endl;
}