#include <cstdio>
#include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
using namespace std;

struct event
{
    int x, type, ind;
    event(){}
    event(int a, int b, int c): x(a), type(b), ind(c) {}
};

bool cmp(event a, event b)
{
    if (a.x == b.x)
        return a.type < b.type;
    return a.x < b.x;
}

int main()
{
    freopen("ant.in", "r", stdin);
    freopen("ant.out", "w", stdout);
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    vector<int> b(m);
    for (int i = 0; i < m; i++)
        cin >> b[i];
    vector<event> v;
    for (int i = 0; i < n; i++)
        v.push_back(event(a[i], 0, i));
    for (int i = 0; i < m; i++)
        v.push_back(event(b[i], 1, i));
    sort(v.begin(), v.end(), cmp);
    vector<int> st;
    vector<int> ans(n);
    while (!v.empty()) 
    {
        event e = v.back();
        v.pop_back();
        if (e.type == 0)
        {
            if (st.empty())
                ans[e.ind] = -2;
            else
            {
                ans[e.ind] = st.back();
                st.pop_back();
            }
        }
        else
            st.push_back(e.ind);
    }
    for (int i = 0; i < n; i++)
        cout << ans[i] + 1 << endl;
    return 0;
}