## Problem Description

Rar the cat has just completed his O levels and is joining the Joint Admissions Exercise (JAE). The Joint Admissions Exercise (JAE) is conducted annually by the Ministry of Education (MOE) to allow Singapore-Cambridge GCE 'O' Level certificate holders to apply for admission to courses offered by:
Junior Colleges (JC),
Millennia Institute (MI),
Polytechnics (Poly),
Institute of Technical Education (ITE).

Rar the cat has somehow managed to obtain a list of everybody's top 5 choices and L1R5 scores, a total of *N* students including Rar the Cat. Now, Rar the Cat wants you to compute which course each person eventually end up in.

For this simplified case, applicants are posted to a course based on merit first according to their L1R5 aggregate scores, starting from the lowest aggregate score. Applicants with better net aggregate scores will be considered for admission first, subject to the availability of vacancies in the selected option. If there is no more vacancy, then the applicant will be considered for their next choice(s).
In the event where there are two or more applicants with the same L1R5 aggregate scores vying for the last place of a particular option, they will be allocated on priority of the order they appear in the list Rar the Cat has.

Each course (labelled from 1 to *C*) has a fixed number of vacancies and the number of vacancies are guaranteed to be non-negative.

## Input

The first line of input consists of 2 integers: *N* and *C*.

The following line contains *C* integers, with the *i*^{th} integer in this line representing the number of vacancy for course *i*.

The subsequent *N* lines will describe one student each by consisting of 6 integers each, with the first being the L1R5 aggregate score (2 ≤ L1R5 score ≤ 54) and the remaining 5 being the student's choices of courses, starting from first choice and ending with the fifth choice. The choice will be represented by the course labels (1 to *C*).

## Output

For each student, output a single integer denoting the course he has been allocated to, in the order of the input.

In the event that the particular student cannot be allocated to any of his 5 choices, output "-1" instead.

## Limits

5 ≤ *C* ≤ *N* for all subtasks.

Subtask 1 (10%): *C* = 5, 0 < *N* ≤ 1000

Subtask 2 (20%): 0 < *N* ≤ 1000

Subtask 3 (30%): *C* = 5, 0 < *N* ≤ 100000

Subtask 4 (40%): 0 < *N* ≤ 100000

Subtask 5 (0%): Sample

## Sample Input 1

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

## Sample Output 1

1
2
3
3
2