#include<bits/stdc++.h>
using namespace std;
char nl = '\n';
using i64 = long long;
void solve(int t) {
// cout << "test #" << t << nl;
i64 n; cin >> n;
vector<i64> A(n);
for (auto& a : A) cin >> a;
i64 sum = accumulate(A.begin(), A.end(), 0LL);
i64 s = 0, e = 2e9;
i64 ans = 0;
while (s <= e) {
i64 mid = (s + e) >> 1;
i64 cnt = (mid * (mid + 1)) / 2LL;
if (cnt <= sum) {
ans = mid + 1;
s = mid + 1;
} else {
e = mid - 1;
}
}
cout << ans << nl;
}
int main() {
int tt = 1;
cin >> tt;
for(int t = 1; t <= tt; t++) solve(t);
}