#include <bits/stdc++.h>
using namespace std;
int main (){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n, m;
cin >> n >> m;
array<int, 2> a[n], b[m];
for (int i = 0; i < n; ++i) {
cin >> a[i][0];
a[i][1] = i + 1;
}
for (int i = 0; i < n; ++i) {
cin >> b[i][0];
b[i][1] = i;
}
int ans[m];
sort(a, a + n);
sort(b, b + m);
for (int i = 0; i < m; ++i) {
ans[b[m - i - 1][1]] = a[i][1];
}
for (int i = 0; i < m; ++i) {
cout << ans[i] << " ";
}
return 0;
}