1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <iostream>

using namespace std;

int main()
{
    int n, k, i=0, j, R, minR=2020;
    cin >> n >> k ;
    do {
        i++;
        j=0;
        do {
            j++;
            cin >> R;
            if (R<minR && (1+i-j)*j<=k) minR=R;
        }
        while (j<i);
    }
    while (i<n);
    cout << minR << endl;
    return 0;
}