#include /** * @title 128-bit int * @docs int128.md */ #ifdef __SIZEOF_INT128__ using uint128_t = __uint128_t; using int128_t = __int128_t; #else #include using uint128_t = boost::multiprecision::uint128_t; using int128_t = boost::multiprecision::int128_t; #endif int main(){ int64_t N, D; std::cin >> N >> D; std::vector x(N), v(N); for(int i = 0; i < N; ++i) std::cin >> x[i]; for(int i = 0; i < N; ++i) std::cin >> v[i]; auto f = [&](int64_t T) -> int128_t{ int128_t ret = std::accumulate(v.begin(), v.end(), 0LL); ret *= T; return ret; }; int64_t lb = 0, ub = 1e18; while(std::abs(lb - ub) > 1){ auto mid = (lb + ub) / 2; if(f(mid) >= D){ ub = mid; }else{ lb = mid; } } std::cout << ub << "\n"; return 0; }