#include <algorithm>
#include <cassert>
#include <limits>
#include <string>
#include <stdio.h>
using namespace std;
int piramida( int const n ) {
return ( n * (n + 1)) / 2;
}
int klin ( int wys, int szer ) {
return piramida(wys) - piramida(wys - szer) - piramida(szer - 1);
}
int szerokosc( int b, int wysokosc ) {
return min( b + 1, wysokosc - b );
}
bool dostepna( int const r, int const b, int const n_wysokosc, int const n_potrzeba ) {
int const wys = r + 1;
int szer = szerokosc(b, r + 1);
return klin( wys, szer ) <= n_potrzeba;
}
int main()
{
int krol = numeric_limits< int >::max();
int n_wysokosc = 0;
int k_potrzeba = 0;
scanf( "%d %d", &n_wysokosc, &k_potrzeba);
for( int r = 0; r < n_wysokosc; ++r ) {
int ile_butelek = r + 1;
bool last = true;
for( int b = 0; b < ile_butelek; ++b ) {
int butelka = numeric_limits< int >::max();
scanf( "%d", &butelka);
if( dostepna( r, b, n_wysokosc, k_potrzeba ) ) {
krol = min( krol, butelka );
last = false;
}
}
if( last ) { break; };
}
printf( "%d\n", krol );
return 0;
}