/* ==============================================================================
*
* Author:
* Name: Adam Jeliński
* Nickname: charodziej <https://github.com/charodziej>
*
* Created: 18:47 10.12.2019
*
* d1b.cpp
*
* g++ -std=c++11 -O3 -o d1b.o d1b.cpp
* ./d1b.o
*
* ============================================================================== */
#include <bits/stdc++.h>
using namespace std;
#ifndef DEBUG
#define DEBUG 0
#elif DEBUG==1
#include "/home/charodziej/Documents/universal-print-in-cpp/lib/universal_print.h"
#endif
#if DEBUG==0
#define watch(...)
#define debug if(0)
namespace cupl{
template <typename T> void print_main(T &x, int y, std::string z){return;}
std::string indentation = "";
void indent(){return;}
void unindent(){return;}
std::string bold(){return "";}
std::string clr(){return "";}
std::string backgr(int x){return "";}
std::string colour(int x){return "";}
void showTypes(bool val){return;}
template <typename T> bool is_iterable(T x){return 0;}
void print_process(...){return;}
}
void print_process(...){return;}
#endif
/* ============================================================================== *
* /\ Please pardon the code above /\ *
* || It is necessary for my library to function properly || *
* ============================================================================== */
typedef signed long long ll;
typedef unsigned long long ull;
constexpr int SIZE = 2010;
int tab[SIZE][SIZE];
int main(){
#if DEBUG==0
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
#endif
int n, k;
while(cin >> n >> k){
int a;
int mini = 1e9;
for (int i = 2; i < n + 2; ++i) {
for (int j = 2; j <= i; ++j) {
cin >> a;
tab[i][j] = tab[i - 1][j - 1] + tab[i - 1][j] - tab[i - 2][j - 1] + 1;
if (tab[i][j] <= k) {
mini = min(mini, a);
}
}
}
cout << mini << '\n';
}
}