#include #include int main() { int T; std::cin >> T; while (T --> 0) { int N; long long W; std::cin >> N >> W; std::vector w(N); for (auto &e : w) std::cin >> e; std::vector F(N + 2); F[0] = 1, F[1] = 2; for (int i = 2; i < N + 2; ++i) { F[i] = F[i - 1] + F[i - 2]; } long long ans = 0; auto dfs = [&](auto dfs, int i, long long rW, long long v) -> void { ans = std::max(ans, v); if (i == -1) return; if (rW < w[i]) { dfs(dfs, i - 1, rW, v); } else { dfs(dfs, i - 1, rW - w[i], v + F[i]); if (i > 0 and rW < w[i] + w[i - 1] and rW >= w[i - 1] and v + F[i + 1] - 2 > ans) { dfs(dfs, i - 1, rW, v); } } }; dfs(dfs, N - 1, W, 0LL); std::cout << ans << std::endl; } }