#include <bits/stdc++.h>

int main() {
    freopen("ant.in", "r", stdin);
    freopen("ant.out", "w", stdout);
    int n, m;
    scanf("%d%d", &n, &m);
    int ant[n];
    int need[m];
    for (int i = 0; i < n; i++)
        scanf("%d", &ant[i]);
    for (int i = 0; i < m; i++)
        scanf("%d", &need[i]);
    int answer[n];
    for (int i = 0; i < n; i++)
        answer[i] = -2;
    int next[n + 1], prev[n + 1];
    for (int i = 0; i < n; i++)
        next[i] = i + 1;
    for (int i = 1; i < n; i++)
        prev[i] = i - 1;
    int listBegin = 0;
    for (int i = 0; i < m; i++) {
        int position = need[i];
        int antId = -1;
        for (int j = listBegin; j != n; j = next[j]) {  
            if (ant[j] > position)
                break;
            antId = j;
        }
        if (antId == -1)
            continue;
        answer[antId] = i;
        if (antId == listBegin) {
            listBegin = next[listBegin];
            continue;
        }
        next[prev[antId]] = next[antId];
        prev[next[antId]] = prev[antId];
    }
    for (int i = 0; i < n; i++)
        printf("%d\n", answer[i] + 1);
    return 0;
}