void main() { alias Entry=Tuple!(int,"a",int,"b",int,"I",int,"id"); const N=readInt; const M=readInt; auto A=new int[N]; auto B=new int[M]; foreach(i;0..N) { A[i]=readInt; } foreach(i;0..M) { B[i]=readInt; } bool f(Entry x,Entry y) { long xa=cast(long)x.a; long ya=cast(long)y.a; long xb=cast(long)x.b; long yb=cast(long)y.b; if(xa*yb==ya*xb) { return x.I>y.I; } return xa*ybB){A=B;return true;}else{return false;}} bool chmax(T)(ref T A,T B){if(A1){int mid=(L+R)/2;(A[mid]1){int mid=(L+R)/2;(A[mid]<=x?L:R)=mid;}return R;}