#include <iostream>
#include <vector>
using namespace std;
struct bottle
{
int depth;
int value;
};
int main()
{
int maximum = 2020;
vector < vector <bottle> > bottles;
int h, n, temp;
cin >> h >> n;
for(int i = 0; i < h; i++)
{
bottles.push_back(vector <bottle>());
for(int j = 0; j < i + 1; j++)
{
cin >> temp;
bottles[i].push_back(bottle {0, temp});
}
}
bottles[0][0].depth = 1;
bottles[1][0].depth = 2;
bottles[1][1].depth = 2;
for(int i = 3; i <= h; i++)
{
bottles[i - 1][0].depth = i;
bottles[i - 1][i - 1].depth = i;
int k = i - 2;
for(int j = 1; j < (i + 1) / 2; j++)
{
bottles[i - 1][j].depth = bottles[i - 1][j - 1].depth + k;
bottles[i - 1][i - j - 1].depth = bottles[i - 1][i - j].depth + k;
k -=2;
}
}
for(int i = 0; i < h; i++)
{
for(int j = 0; j < i + 1; j++)
{
if(bottles[i][j].depth <= n && bottles[i][j].value < maximum)
{
maximum = bottles[i][j].value;
}
}
}
cout << maximum << endl;
return 0;
}