#include <bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define boost ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define F(i,k,n) for(int i = k ; i < n ; ++i)
#define sz(x) (int)x.size()
#define var(x) #x << " " << x
#define all(v) (v).begin(), (v).end()
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int,int> PII;
typedef pair<int,LL> PIL;
typedef pair<LL,int> PLI;
typedef pair<LL,LL> PLL;
typedef vector<int> VI;
typedef vector<PII> VII;
typedef vector<LL> VLL;
const int INF=1e9+7,N=1e3+7;
int n,k,wyn=4000,a,b;
int main() {
boost;
cin >> n >> k;
for(int i=1;i<=n;i++)
for(int j=1;j<=i;j++){
cin >> a;
b=i*j-j*(j-1);
if(b<=k)
wyn=min(wyn,a);
}
cout << wyn << "\n";
}