1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef pair<ll, ll> PLL;

#define REP(i, j) for(int i=0;i<j;i++)
#define FOR(i, b, e) for(int i=b; i<=e; i++)
#define FORD(i, b, e) for(int i=b; i>=e; i--)
#define SIZE(x) ((int)x.size())
#define LAST(x) (x[SIZE(x)-1])
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sp ' '
#define ent '\n'

int n, k, a;
int t[2100][2100];
int wiek[2100][2100];

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> n >> k;

    REP(i, 2090){
        REP(j, 2090){
            t[i][j] = i*j;
        }
    }

    ll mini = 1000000;
    REP(i, n){
        int pom = 0;
        REP(j, i+1){
            cin >> a;
            wiek[i+1-pom][j+1] = a;
            ++pom;
        }
    }
    REP(i, 2090){
        REP(j, 2090){
            if(t[i][j]!=0 && t[i][j]<=k && wiek[i][j]!=0 && wiek[i][j]<mini)mini = wiek[i][j];
        }
    }
    cout << mini;

    return 0;
}