#pragma GCC optimize("Ofast") #include using namespace std; using ll = long long; using pii = pair; using pll = pair; constexpr char ln = '\n'; constexpr long long MOD = 1000000007LL; constexpr long long INF = 1001001001LL; constexpr long long LINF = 1001001001001001001; #define all(x) (x).begin(),(x).end() #define rep(i,n) for(int i=0;i<(n);i++) #define rept(i, j, n) for(int i=(j); i<(n); i++) template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } int main(){ int n, d; cin >> n >> d; vector X(n), V(n); rep(i, n)cin >> X[i]; rep(i, n)cin >> V[i]; ll ng = -1, ok = INF; while(ok - ng > 1){ ll mid = (ok + ng) / 2; ll sum = 0; rep(i, n){ sum += V[i] * mid; if(sum>=d)break; } if(mid==2)cout << sum << ln; if(sum>=d)ok = mid; else ng = mid; } cout << ok << ln; }