You have a card deck of n cards, numbered from top to bottom, i. e. the top card has index 1 and bottom card — index n. Each card has its color: the i-th card has color a_i.

You should process q queries. The j-th query is described by integer t_j. For each query you should: 

  * find the highest card in the deck with color t_j, i. e. the card with minimum index; 
  * print the position of the card you found; 
  * take the card and place it on top of the deck. 

Input

The first line contains two integers n and q (2 ≤ n ≤ 3 ⋅ 10^5; 1 ≤ q ≤ 3 ⋅ 10^5) — the number of cards in the deck and the number of queries.

The second line contains n integers a_1, a_2, ..., a_n (1 ≤ a_i ≤ 50) — the colors of cards.

The third line contains q integers t_1, t_2, ..., t_q (1 ≤ t_j ≤ 50) — the query colors. It's guaranteed that queries ask only colors that are present in the deck.

Output

Print q integers — the answers for each query.

Example

Input


7 5
2 1 1 4 3 3 1
3 2 1 1 4


Output


5 2 3 1 5 

Note

Description of the sample: 

  1. the deck is [2, 1, 1, 4, \underline{3}, 3, 1] and the first card with color t_1 = 3 has position 5; 
  2. the deck is [3, \underline{2}, 1, 1, 4, 3, 1] and the first card with color t_2 = 2 has position 2; 
  3. the deck is [2, 3, \underline{1}, 1, 4, 3, 1] and the first card with color t_3 = 1 has position 3; 
  4. the deck is [\underline{1}, 2, 3, 1, 4, 3, 1] and the first card with color t_4 = 1 has position 1; 
  5. the deck is [1, 2, 3, 1, \underline{4}, 3, 1] and the first card with color t_5 = 4 has position 5. 
#include <bits/stdc++.h>
using namespace std;
 
// Method to get vector
vector<int> gv(int N)
{
    vector<int> V;
    while(N--)
    {
        int temp;
        cin>>temp;
        V.push_back(temp);
    }
    return V;
}
 
void pyn(int flag)
 
{
        if(flag==0)
        {
            cout<<"NO"<<endl;
        }
        else
        {
            cout<<"YES"<<endl;
        }
}
 
void pv(vector<int> v)
{
    for(int i=0;i<v.size();i++)
    {
        cout<<v[i]<<" ";
    }
    cout<<endl;
}
 
void pr(int i, long long ans)
{
    cout<<"Case #"<<i<<": "<<ans<<endl;
}
 
void prgv(int i, vector<int> V)
{
    cout<<"Case #"<<i<<": ";
    pv(V);
}
 
void prc(int i)
{
    cout<<"Case #"<<i<<": ";
}
 
 
int Go(vector<vector<int>> &Mat, vector<int> &rows, vector<int> &cols)
{
    int flag=0;
    for(int i=0;i<Mat.size();i++)
    {
        for(int j=0;j<Mat[0].size();j++)
        {
            if(Mat[i][j]==-1)
            {
                if(rows[i]==1 || cols[j]==1)
                {
                    rows[i]--;
                    cols[j]--;
                    Mat[i][j]=2;
                    flag=1;
                }
            }
        }
    }
    return flag;
}
 
int check(vector<vector<int>> &Mat)
{
    for(int i=0;i<Mat.size();i++)
    {
        for(int j=0;j<Mat[0].size();j++)
        {
            if(Mat[i][j]==-1)
            {
                return 1;
            }
        }
    }
    return 0;
}
 
int findCost(vector<vector<int>> &Mat, vector<vector<int>> &B, vector<int> &rows, vector<int> &cols)
{
    int r=-1,c=-1, ans=INT_MAX;
    for(int i=0;i<Mat.size();i++)
    {
        for(int j=0; j<Mat[0].size();j++)
        {
            if(Mat[i][j]==-1)
            {
                if(ans>B[i][j])
                {
                    ans=B[i][j];
                    r=i;
                    c=j;
                }
            }
        }
    }
    if(c==-1)
    {
        return 0;
    }
    Mat[r][c]=2;
    rows[r]--;
    cols[c]--;
    return ans;
}
 
long  long getcost(vector<int> V, int n)
{
        long long ans=0;
        for(int i=0;i<n-1;i++)
        {
            int low=V[i],ind=i;
            for(int j=i; j<n;j++)
            {
                if(V[j]<low)
                {
                    ind=j;
                    low=V[j];
                }
            }
            ans+=ind-i+1;
            reverse(V.begin()+i,V.begin()+ind+1);
        }
        return ans;
}
 
int getDigSum(long long n)
{
    int ans=0;
    while(n!=0)
    {
        ans+=n%10;
        n/=10;
    }
    return ans;
}
 
long long gcd(long long a, long long b)
{
    if(a==0 || b==0)
    {
        return max(a,b);
    }
    if(a>b)
    {
        a%=b;
    }
    else
    {
        b%=a;
    }
    return gcd(a,b);
}
 
int gp2(int X)
{
    int ans=0;
    while(X!=0)
    {
        X/=2;
        ans++;
    }
    return ans;
}
 
int checkdone(vector<int> &V)
{
    for(int i=0;i<V.size();i++)
    {
        if(V[i]>0)
        {
            return 1;
        }
    }
    return 0;
}
 
int isPalindrome(string s)
{
    int flag=1;
    for(int i=0;i<s.size()/2;i++)
    {
        if(s[i]!=s[s.size()-i-1])
        {
            flag=0;
            break;
        }
    }
    return flag;
}
 
long long fact(long long n)
{
    long long ans=1;
    for(int i=1;i<=n;i++)
    {
        ans*=(long long)i;
        ans%=1000000007;
    }
    return ans;
}
long long recur(vector<long long> &DP, int m)
{
    if(m<0)
    {
        return 0;
    }
    if(DP[m]!=(long long)-1)
    {
        return DP[m]%1000000007;
    }
    else
    {
        if(m<10)
        {
            DP[m]=1;
            return DP[m]%1000000007;
        }
        DP[m]=(recur(DP,m-10)+recur(DP,m-9))%1000000007;
    }
    return DP[m]%1000000007;
}
 
int main()
{
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    int t;
    //cin>>t;
    t=1;
    for(int q=0;q<t;q++)
    {
        int n,k;
        cin>>n>>k;
        vector<int> cards = gv(n), queries=gv(k), colors(50,-100000);
        for(int i=0;i<n;i++)
        {
            if(colors[cards[i]-1]==-100000)
            {
                colors[cards[i]-1]=i;
            }
        }
        for(int i=0;i<k;i++)
        {
            int cur=queries[i], X=colors[cur-1];
            cout<<X+1<<" ";
            for(int j=0;j<50;j++)
            {
                if(colors[j]<X)
                {
                    colors[j]++;
                }
            }
            colors[cur-1]=0;

        }
     
    }
        
    return 0;
}
