#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N>>M; FOR(i,N) cin>>A[i]; FOR(i,N) cin>>K[i], tot += K[i]*A[i]; if(tot=i && i==ne[x]) ret=min(ret,can[i]+(M-i)/A[x]), ne[x] += A[i]; } if(ret>=1LL<<60) ret=-1; cout<