## Back From Summer '19 P1: Winnie's Orphans

View as PDF

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Winnie is feeling generous today, so she decided to adopt all the children in an orphanage. There are orphanages, numbered from to , that she can choose from. Each orphanage has children. Each children has a cuteness value of ranging from to . Winnie cannot handle children that are too cute, or children that are too ugly. Because of this, Winnie wants to choose the orphanage that has the least number of children with a cuteness value of or . Can you help Winnie find this orphanage?

#### Input Specification

The first line of input will contain two integers , the number of orphanages and the number of children in each orphanage.

The next lines will each contain integers, representing the cuteness values of each children. Line will represent the children from orphanage . The cuteness values are between and , inclusive.

#### Output Specification

Output the index of orphanage with the least number of children with a cuteness value of or . If multiple orphanages exists, output the one with the smallest index.

#### Sample Input

3 3
2 1 8
4 10 9
3 6 4

#### Sample Output

3

#### Explanation For Sample

The third orphanage has no children with a cuteness value of or , while the first and second orphanages both have one children.