#include using namespace std; typedef long long int ll; typedef unsigned long long ull; typedef long double ld; int dx[8] = { 1, 0, -1, 0, 1, 1, -1, -1 }, dy[8] = { 0, 1, 0, -1, 1, -1, 1, -1 }; const long long mod = 998244353; const ll inf = 1LL << 60; const int INF = 5e8; int main() { 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]; vector c(n); priority_queue, vector>> q; for (int i = 0; i < n; i++) { q.emplace((ld)a[i] / b[0], -i); c[i]++; } int sz = 0; while (q.size()) { auto [_, i] = q.top(); q.pop(); if (sz == m) break; i *= -1; cout << i + 1 << endl; sz++; if (c[i] < m) { q.emplace((ld)a[i] / b[c[i]], -i); c[i]++; } } }