#include<iostream> #include<vector> #include<algorithm> #include<tuple> using namespace std; using ll=long long; #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template<class T> bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template<class T> bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} const double eps=1e-12; bool compare(tuple<ll,ll,int>&t1,tuple<ll,ll,int>&t2){ if(get<0>(t1)*get<1>(t2)>get<1>(t1)*get<0>(t2)){ return true; }else if(get<0>(t1)*get<1>(t2)<get<1>(t1)*get<0>(t2)){ return false; }else{ if(get<2>(t1)<get<2>(t2))return true; else return false; } } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,M; cin>>N>>M; vector<ll>A(N),B(M); for(int i=0;i<N;i++)cin>>A[i]; for(int i=0;i<M;i++)cin>>B[i]; double ok=0,ng=2e9; for(int i=0;i<100;i++){ double mid=(ok+ng)/2; int cnt=0; for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ if(A[i]>B[j]*mid+eps){ cnt++; }else{ break; } if(cnt>=M)break; } if(cnt>=M)break; } if(cnt>=M)ok=mid; else ng=mid; } vector<tuple<ll,ll,int>>vp; for(int i=0;i<N;i++){ for(int j=0;j<M;j++){ if(A[i]>B[j]*ok+eps){ vp.push_back(make_tuple(A[i],B[j],i)); }else{ break; } } } sort(all(vp),compare); for(int i=0;i<M;i++){ cout<<get<2>(vp[i])+1<<"\n"; } }