#include using namespace std; int main() { int N; long long D; cin >> N >> D; vector x( N ); for( int i = 0; i < N; i++ ) { cin >> x[i]; } vector v( N ); for( int i = 0; i < N; i++ ) { cin >> v[i]; } const long long INF = INT32_MAX; auto f = [&]( long long t ) -> long long { long long res = 0; for( int i = 0; i < N; i++ ) { res += v[i] * t; if( v[i] * t < 0 || res < 0 ) return INF; } return res; }; long long l = 0; long long r = INF; while( r - l > 1 ) { long long m = (l + r) / 2; if( f( m ) >= D ) r = m; else l = m; } long long ans = r; cout << ans << endl; }