In this world, everyone needs to work to earn money to survive.
Jobs are provided by armored men (盔甲人), and little cutes (小可愛) will try to get the jobs they want.
After working, the armored men will calculate the day's salary for each little cute.
To efficiently pay salaries to little cutes, the armored men need to track which job is chosen by which little cute. Therefore, they decided to write a program to assist them.
There are N jobs, numbered from 1 to N, and each job has a type ti (1 ≤ i ≤ N). There are M little cutes lined up for the jobs. Each little cute wants to apply for kj (1 ≤ j ≤ M) jobs, and once a little cute gets all his jobs, he will leave the queue; otherwise, he will stay in the queue and cry, and at last the little cute and those behind him all can't get the jobs.
Note that when choosing a job, among jobs of this type, a little cute will choose the job with the smallest job_id (1 ≤ job_id ≤ N). Each job can only be chosen once.
For each job, you should output the little_cute_id (1 ≤ little_cute_id ≤ M) of the little cute who has taken it, or 0 if nobody does.
The first line of input contains two positive integers M, N, as described in the statement.
Next, there would be M job sets, each represented by two lines: 1) the first line contains a single positive integer kj, denoting the size of the jth little cute's job set; 2) the second line contains kj integers, each denoting one of the job types in this job set.
Finally, there would be N integers, t1∼ tN, as the statement describes.
Output N lines, each containing a single integer, indicating which little cute has taken the corresponding job.