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
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
 *
 *  1. sprawdz corner cases
 *  2. sprawdz limity, jesli sie da pozamieniaj wszystkie lokalne zmienne na LL!
 *  3.  MINIMALNE I MAKSYMALNE WEJŚCIE I WYJŚCIE
 *  4. lokalne zmienne, iteracja po tablicach dwuwymiarowych uwazaj
 *  5. SPRAWDZ CZY input jest POSORTOWANY jaki jest niezmiennik
 *
 *
 */
#include <algorithm>
#include <cstdio>
#include <iomanip> // std::setprecision
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <unordered_map>
#include <vector>

#define FOR(x, y, z) for (int x = (y); x < (z); x++)
#define FORD(x, y, z) for (int x = (y); x >= z; x--)
#define REP(r, n) for (int r = 0; r < (n); r++)
#define MP make_pair
#define ST first
#define ND second
#define SIZE(c) ((int)((c).size()))
#define FOREACH(i, x) for (__typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define ALL(u) (u).begin(), (u).end()
#define RALL(u) (u).rbegin(), (u).rend()
#define PB push_back
#define PF push_front
#define SZ(x) long long((x).size())
#define IS_IN(x, t) (t.find(x) != t.end())
#define BIT(n, i) (((n) >> (i)) & 1)

#ifdef LOCAL
#define LASSERT(X) assert(X)
#else
#define LASSERT(X) \
    {              \
    }
#endif

#define TYPEMAX(type) std::numeric_limits<type>::max()
#define TYPEMIN(type) std::numeric_limits<type>::min()

using namespace std;

typedef long long LL;
typedef long double LD;
typedef vector<string> VI;
typedef pair<LL, LL> PR;

inline LL GCD(LL a, LL b)
{
    LL r;
    while (b) {
        r = a % b;
        a = b;
        b = r;
    }
    return a;
};
inline LL LCM(LL a, LL b) { return a / GCD(a, b) * b; };
inline LL fpow(LL n, LL k, LL p)
{
    LL r = 1;
    for (; k; k >>= 1) {
        if (k & 1)
            r = r * n % p;
        n = n * n % p;
    }
    return r;
};
inline LL inv(LL a, LL p) { return fpow(a, p - 2, p); }

[[maybe_unused]] const LL MOD = (LL)1e9 + 7;
[[maybe_unused]] const LL MAXUS = TYPEMAX(LL);
[[maybe_unused]] const LD PI = acos((LD)-1);
[[maybe_unused]] const LD epsilon = 1e-9;

template <typename T>
T input()
{
    T res;
    cin >> res;
    LASSERT(cin);
    return res;
}

template <typename IT>
void input_seq(IT b, IT e)
{
    std::generate(b, e, input<typename std::remove_reference<decltype(*b)>::type>);
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    int bestYear = 2020;
    vector<pair<int, int>> wine;
    FOR(i, 1, n + 1)
    { // level
        FOR(j, 1, i + 1)
        { // nodes
            int age;
            cin >> age;
            int curEffort = j * (i-j+1);
            if (k >= curEffort) {
              bestYear = min(age, bestYear);
            }
        }
    }
    cout <<bestYear << endl;

    return 0;
}