#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
int t;
long long n, k;
vector<long long> v;
bool check(long long num) {
for (int i = 0; i < n; i++) {
vector<long long> v_c(v.begin(), v.end());
long long charge = k;
long long nn = num;
v_c[i] = nn;
for (int j = i; j < n; j++) {
if (v_c[j] <= v[j])return true;
if (j + 1 < n)v_c[j + 1] = v_c[j] - 1;
charge -= (v_c[j] - v[j]);
if (charge < 0)break;
}
}
return false;
}
int main() {
fast;
cin >> t;
while (t--) {
cin >> n >> k;
v.resize(n);
for (auto &ele: v)cin >> ele;
long long l = 1, r = 1e9;
long long ans = 0;
while (l <= r) {
long long mid = (l + r) / 2;
if (!check(mid))r = mid - 1;
else ans = mid, l = mid + 1;
}
cout << ans << endl;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgZmFzdCBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKGZhbHNlKTtjaW4udGllKE5VTEwpCmludCB0Owpsb25nIGxvbmcgbiwgazsKdmVjdG9yPGxvbmcgbG9uZz4gdjsKCmJvb2wgY2hlY2sobG9uZyBsb25nIG51bSkgewogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBuOyBpKyspIHsKICAgICAgICB2ZWN0b3I8bG9uZyBsb25nPiB2X2Modi5iZWdpbigpLCB2LmVuZCgpKTsKICAgICAgICBsb25nIGxvbmcgY2hhcmdlID0gazsKICAgICAgICBsb25nIGxvbmcgbm4gPSBudW07CiAgICAgICAgdl9jW2ldID0gbm47CiAgICAgICAgZm9yIChpbnQgaiA9IGk7IGogPCBuOyBqKyspIHsKICAgICAgICAgICAgaWYgKHZfY1tqXSA8PSB2W2pdKXJldHVybiB0cnVlOwogICAgICAgICAgICBpZiAoaiArIDEgPCBuKXZfY1tqICsgMV0gPSB2X2Nbal0gLSAxOwogICAgICAgICAgICBjaGFyZ2UgLT0gKHZfY1tqXSAtIHZbal0pOwogICAgICAgICAgICBpZiAoY2hhcmdlIDwgMClicmVhazsKICAgICAgICB9CiAgICB9CiAgICByZXR1cm4gZmFsc2U7Cn0KCmludCBtYWluKCkgewogICAgZmFzdDsKICAgIGNpbiA+PiB0OwogICAgd2hpbGUgKHQtLSkgewogICAgICAgIGNpbiA+PiBuID4+IGs7CiAgICAgICAgdi5yZXNpemUobik7CiAgICAgICAgZm9yIChhdXRvICZlbGU6IHYpY2luID4+IGVsZTsKICAgICAgICBsb25nIGxvbmcgbCA9IDEsIHIgPSAxZTk7CiAgICAgICAgbG9uZyBsb25nIGFucyA9IDA7CiAgICAgICAgd2hpbGUgKGwgPD0gcikgewogICAgICAgICAgICBsb25nIGxvbmcgbWlkID0gKGwgKyByKSAvIDI7CiAgICAgICAgICAgIGlmICghY2hlY2sobWlkKSlyID0gbWlkIC0gMTsKICAgICAgICAgICAgZWxzZSBhbnMgPSBtaWQsIGwgPSBtaWQgKyAxOwogICAgICAgIH0KICAgICAgICBjb3V0IDw8IGFucyA8PCBlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0=