Under construction

Still being built. Things may change

Samba

Interview

Time limit1sMemory limit64 MB

Summary
Given the school IDs of n dancers, find the single school whose total dancer count is not a multiple of k.
Level

Easy3 of 10

Topics
Hash map, Array
Solved
No attempts yet

Problem

Every year, Rio de Janeiro hosts a grand samba dance festival. This year, nn dancers from samba schools around the world perform in the streets, trying to impress the crowd with both their dancing and their costumes.

Each samba school is represented by exactly one group of dancers and has a unique identification number (ID). Every member of a school wears that same ID while moving in formation.

To keep the formations tidy, the organizers require each school to arrange all of its dancers into rows of exactly kk dancers. A school with mm dancers can do this only when mm is a multiple of kk.

Exactly one samba school is unable to arrange its dancers under this rule. Given the school ID worn by each of the nn dancers, determine that school's ID.

Input

The first line contains two space-separated integers nn and kk.

Each of the next nn lines contains one integer CiC_i — the ID of the school that the ii-th dancer belongs to.

Output

Print a single integer: the ID of the one samba school whose number of dancers is not a multiple of kk.

Constraints

  • 1≤n≤1061 \le n \le 10^6
  • 2≤k≤1032 \le k \le 10^3
  • 0≤Ci≤1090 \le C_i \le 10^9
  • Exactly one school has a dancer count that is not a multiple of kk.

Hint

Suppose there are 1111 dancers from schools 123123, 16781678, and 4343, with k=2k = 2. School 123123 has 66 dancers (33 rows of 22) and school 16781678 has 22 dancers (11 row of 22). School 4343 has 33 dancers, which cannot be split into rows of exactly 22, so the answer is its ID, 4343.

Examples4

  1. Example 1

    Input
    11 2
    123
    1678
    43
    123
    123
    43
    123
    43
    123
    1678
    123
    
    Expected output
    43
    
  2. Example 2

    Input
    3 2
    7
    7
    7
    
    Expected output
    7
    
  3. Example 3

    Input
    4 3
    5
    0
    5
    5
    
    Expected output
    0
    
  4. Example 4

    Input
    7 5
    8
    8
    8
    8
    8
    3
    3
    
    Expected output
    3