#include using namespace std; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector 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 = 1e-10, ng = 1e10; for(int t = 0; t < 50; t++) { double m = (ok + ng) / 2; int cnt = 0; for(int i = 0; i < N; i++) { if(cnt >= M) { break; } for(int j = 0; j < M; j++) { if((double) A[i] / B[j] >= m) { cnt++; if(cnt >= M) { break; } } else { break; } } } if(cnt >= M) { ok = m; } else { ng = m; } } vector a, b, c; for(int i = 0; i < N; i++) { for(int j = 0; j < M; j++) { if((double) A[i] / B[j] >= ok) { a.push_back(A[i]); b.push_back(B[j]); c.push_back(i); } else { break; } } } int sz = a.size(); vector id(sz); for(int i = 0; i < sz; i++) { id[i] = i; } sort(id.begin(), id.end(), [&] (int i, int j) { if((long long) a[i] * b[j] == (long long) a[j] * b[i]) { return c[i] < c[j]; } else { return (long long) a[i] * b[j] > (long long) a[j] * b[i]; } }); for(int i = 0; i < M; i++) { cout << c[id[i]] + 1 << '\n'; } return 0; }