'''
Don't Copy This Code, Try To Solve It By Yourself
'''
def Solve():
n, qs = map(int, input().split())
a = list(map(int, input().split()))
q = list(map(int, input().split()))
for i in q:
x=a.index(i)
print(x+1, end=" ")
a[:x+1]=[i]+a[:x]
if __name__ == "__main__":
Solve()
#include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,q;
cin>>n>>q;
vector<int> cards(n);
for (int i = 0; i < n; ++i) {
cin>>cards[i];
}
vector<int> queries(q);
for (int i = 0; i <q; ++i) {
cin>>queries[i];
}
for (int i = 0; i < q; ++i) {
auto it=std::find(cards.begin(), cards.end(),queries[i]);
int index=it-cards.begin();
cout<<index+1<<" ";
for (int j = index; j >=1; --j) {
swap(cards[j],cards[j-1]);
}
}
cout<<endl;
return 0;
}
38E - Let's Go Rolling | 171G - Mysterious numbers - 2 |
1183C - Computer Game | 400C - Inna and Huge Candy Matrix |
417A - Elimination | 222A - Shooshuns and Sequence |
1736A - Make A Equal to B | 1736B - Playing with GCD |
887C - Solution for Cube | 1737C - Ela and Crickets |
1741C - Minimize the Thickness | 1741A - Compare T-Shirt Sizes |
1741D - Masha and a Beautiful Tree | 109B - Lucky Probability |
1741B - Funny Permutation | 1741E - Sending a Sequence Over the Network |
344B - Simple Molecules | 370A - Rook Bishop and King |
546E - Soldier and Traveling | 1741G - Kirill and Company |
1200B - Block Adventure | 1088B - Ehab and subtraction |
1270B - Interesting Subarray | 478C - Table Decorations |
1304C - Air Conditioner | 1311C - Perform the Combo |
1519C - Berland Regional | 361A - Levko and Table |
5E - Bindian Signalizing | 687A - NP-Hard Problem |