1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <vector>
#include <cstdio>
using namespace std;

int t(int n) {
  return n*(n+1)/2;
}

int main() {
	int n,k;
	scanf("%d %d",&n,&k);
  int ret = 2020;
	for (int i = 1; i <= n; i++) for (int j = 1; j <= i; j++) {
	  int us = t(i) - t(j-1) - t(i-j);
		//printf("%d ", us); if(j==i) printf("\n");
		int a;
		scanf("%d", &a);
		if (us <= k) ret = std::min(ret, a);
	}
	printf("%d\n", ret);
	return 0;
}