#include <bits/stdc++.h>   using namespace std;      #define int               long long   #define ld                long double   #define ll                unsigned int   #define endl                n       #define mp                make_pair   #define hcf               __gcd   #define test              cout<< hello ;   #define lcm(m,n)          m*(n/__gcd(m,n))   #define maxa(v)           *(max_element(all(v))   #define mina(v)           *(min_element(all(v))      #define pb                push_back   #define ppb               pop_back   #define pf                push_front   #define ppf               pop_front   #define ff                first    #define ss                second   #define doge              cout<< *       #define mod               (int)1e9   #define all(x)            (x).begin(),(x).end()   #define uniq(v)           (v).erase(unique(all(v)),(v).end())   #define sz(x)             (int)((x).size())   #define asort(v)          sort(v.begin(),v.end())   #define dsort(v)          sort(v.begin(),v.end(),greater<int>())   #define present(c,e)      (c.find(e) != c.end())   #define vfind(c,e)     (find(all(c),e) != c.end())   #define tr(c,it)          for(typeof(c.begin()) it = c.begin(); it != c.end(); it++)            //////////////////////////////////////////////////////////////////////////////////////////////////////////                 bool isPrime(ll n)        {            if (n <= 1) return false;            if (n <= 3) return true;                    if (n%2 == 0 || n%3 == 0) return false;                    for (ll i=5; i*i<=n; i=i+6)                if (n%i == 0 || n%(i+2) == 0)                return false;                    return true;        }                        long long power(int n,int k)       {           if(k==0)    return 1;           else return (n*power(n,k-1)%1000000007);       }               long long nCr(int n,int r)       {           if(n==r)    return 1;           else if (r==0)  return 1;           else return ((nCr(n-1,r-1)+nCr(n-1,r))%998244353);       }          long long sumDigit(ll x)       {           ll ans=0;           while(x)           {               ans+=x%10;               x/=10;           }           return ans;vector<int> v;       }              int bs(int a[],int b,int l,int r)       {           int mid=(l+r)/2;           if(l>r) return (int)-1;           if(a[mid]==b||l==r) return mid;           if(a[mid]>b)    return bs(a,b,l,mid-1);           else return bs(a,b,mid+1,r);       }          int divideandconquerbc(int a[],int l,int r)       {           if(l>=r)    return 0;           int mid=(l+r)/2,ans=0;           ans+=divideandconquerbc(a,l,mid);           ans+=divideandconquerbc(a,mid+1,r);           int x=r-l+1,y=mid-l+1;           int c[x];           int i=0,j=0;           for(int k=0;k<x;k++)           {               if((a[l+i]<=a[mid+1+j]&&i<y)||j>=x-y)   {c[k]=a[l+i];i++;}               else {c[k]=a[mid+1+j];j++;ans+=y-i;}           }           for(int k=l;k<=r;k++)               a[k]=c[k-l];           return ans;       }          long long  gcd(ll a,ll b)       {           if (b==0) return a;           return gcd(b,a%b);       }                  ////////////////////////////////////////////////////////////////////////////////////////////////////////////////      // count sum count1, cnt,cnt1 sum1 carry tip mx mn a1 a2 a3    // may the force be with us         void solve(){       int n,q;       cin>>n>>q;       set<int>s;       map<int,int>m;       for (int i = 0; i < n; ++i)       {           int x;           cin>>x;           if(!present(s,x)){               m[x]=i+1;               s.insert(x);           }       }       for (int i = 0; i < q; ++i)       {           int z;           cin>>z;           cout<<m[z]<<   ;           for(auto i:m){               if(i.ss<m[z]){                   m[i.ff]++;               }           }           m[z]=1;       }                                   cout<<endl;}   signed main(){          ios_base::sync_with_stdio(false);       cin.tie(0);cout.tie(0);       #ifndef ONLINE_JUDGE       freopen( input.txt ,  r , stdin);       freopen( output.txt ,  w , stdout);       #endif          int tsc=1;      // cin>>tsc;       while(tsc--) solve();       return 0;          }