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;
#define endl "\n"
#define pb push_back
#define mod 1000000007
int prime[1000009];
void prime_seive()
{
   for(int i=2;i*i<1000009;i++)
   {
      if(!prime[i])
      {
         for(int j=i*i;j<1000009;j+=i)
          prime[j]=1;
      }
   }
}
long long myceil_ll(long long a,long long b)
{
   return (a+b-1)/b;
}
int myceil_int(int a,int b)
{
   return (a+b-1)/b;
}
void found(int key,int pos,int n,int &lcount,int &rcount)
{
   long long low=0,high=n;
   //if(b<0)return false;
   int count=0;
        while(low<high)
        {
           long long mid=(low+high)/2;
        //cout << low << " " << mid << " " << high << endl;
           if(mid>pos)
           {
             rcount++;high=mid;
           }
           else if(mid<pos)
           {
             lcount++;low=mid+1;
           }
           else
            return ;
        }
        return;
}
bool is_ans(int temp)
{
   int po=sqrt(temp);
   if(po*1ll*po==temp)
    return true;
  return false;
}
bool isvalid(char grid[][4],int r,int c)
{
   if(r<0 || r>=4 || c<0 || c>3)
    return false;
   if(grid[r][c]=='p'|| grid[r][c]=='X')
    return false;
   return true;
}
void findpath(char grid[][4],int i,int j,int& found)
{
   // cout << i << " " << j << endl;
    if(!isvalid(grid,i,j))return;
    if(grid[i][j]=='g')
    {
      cout << i << " " << j << endl;
      found=true;
      return;
    }
    if(isvalid(grid,i+1,j))
      findpath(grid,i+1,j,found);
    if(found)
    {
       cout << i << " " << j << endl;
       return ;
    }
    if(isvalid(grid,i,j+1))
      findpath(grid,i,j+1,found);
    if(found)
    {
      cout << i << " " << j << endl;
      return;
    }

}
bool equal(vector<int> diff)
{
   for(int i=1;i<diff.size();i++)
   {
     if(diff[i]!=diff[i-1])return false;
   }
   return true;
}
int LCSubStr(char* X, char* Y, int m, int n)
{
    // Create a table to store
    // lengths of longest
    // common suffixes of substrings.  
    // Note that LCSuff[i][j] contains
    // length of longest common suffix
    // of X[0..i-1] and Y[0..j-1].
 
    int LCSuff[m + 1][n + 1];
    int result = 0; // To store length of the
                    // longest common substring
 
    /* Following steps build LCSuff[m+1][n+1] in
        bottom up fashion. */
    for (int i = 0; i <= m; i++)
    {
        for (int j = 0; j <= n; j++)
        {
            if (i == 0 || j == 0)
                LCSuff[i][j] = 0;
 
            else if (X[i - 1] == Y[j - 1]) {
                LCSuff[i][j] = LCSuff[i - 1][j - 1] + 1;
                result = max(result, LCSuff[i][j]);
            }
            else
                LCSuff[i][j] = 0;
        }
    }
    return result;
}
int partition(int arr[],int start,int end)
{
   int pivot = start+rand()%(end-start+1);
   swap(arr[pivot],arr[end]);
   int greater_index=start;
   for(int i=start;i<end;i++)
   {
     if(arr[i]<arr[end])
      {
        swap(arr[i],arr[greater_index]);
        greater_index++;
      }
   }
   swap(arr[greater_index],arr[end]);
   return greater_index;
}
void quick_sort(int arr[],int start,int end,int n)
{
   if(start>=end)return;
   int pivot = partition(arr,start,end);
   quick_sort(arr,start,pivot-1,n);
   quick_sort(arr,pivot+1,end,n);
}
int len(long long num)
{
   int count=0;
   while(num>0)
   {
     num/=10;
     count++;
   }
   return count;
}
int ok(string &curr,string &prev)
{
  //cout << "I" << endl;
  string  a=curr;
  string b=prev;
  int times=b.size()-a.size();
  if(times<=0)return 0;
  string another=curr;
  for(int i=0;i<times;i++)
   {
      another.push_back('0');
   }
  if(another>prev)
    {
      curr=another;
      return times;
    }
  for(int i=0;i<times;i++)
     {
      a.push_back('9');
    }
  if(a>prev)
  {
    curr=prev;
    char ch=curr.back();
    curr.pop_back();
    int num=ch-'0';
    num++;
    curr.push_back(num+'0');
    return times;
  }
  return 0;
}
long long fact(int num)
{
  long long prod=1;
  for(int i=2;i<=num;i++)
  {
    prod*=i;
    prod%=mod;
  }
  return prod;
}
int len(int num)
{
   int count=0;
   while(num>0)
   {
     count++;
     num/=10;
   }
   return count;
}
int power(int a,int b)
{
   int ans=1;
   for(int i=0;i<b;i++)
     ans*=a;
   return ans;
}
void update(int color[],int col)
{
   for(int i=1;i<51;i++)
   {
     if(color[i]!=0 && color[i]<color[col])color[i]++;
   }
   color[col]=1;
}
void t_c()
 {
   int n;
   cin >> n;
   int q;
   cin >> q;
   int arr[n];
   for(int i=0;i<n;i++)
     cin >> arr[i];
   int color[51]={0};
   for(int i=0;i<n;i++)
   {
     if(color[arr[i]]==0)
     {
       color[arr[i]]=i+1;
     }
   }
  //  for(int i=1;i<5;i++)
  //   cout << color[i] << " ";
  // cout << endl;
   for(int i=0;i<q;i++)
   {
      int col;cin >> col;
      cout << color[col] << " ";
      update(color,col);
   }
 }
int main()
{
   //prime_seive();
  /*
  freopen("input.txt","r",stdin);
  freopen("output.txt","w",stdout);
  */
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t=1;
  //cin >> t;
  for(int i=0;i<t;i++)
  {
     t_c();
  }
}