First frequent multiple X10534


Statement
 

pdf   zip

html

Write a program that reads a sequence of integer numbers, and prints the first one that is multiple of a given number n and appears at least a given number of times k.

Input The input consists of two numbers n,k > 0, followed by a sequence of integers.

Output The output the first number in the sequence that is multiple of n and appears at least k times in the sequence. If there is no such number, the program will print none.

Public test cases
  • Input

    3 4
    1 5 6 12 8 6 3 2 6 6 10 12 7 6 1
    

    Output

    6
    
  • Input

    5 2
    4 -8 10 10 25 -30 12
    

    Output

    10
    
  • Input

    3 5
    2 3 2 3 6 3 9 3 1
    

    Output

    none
    
  • Information
    Author
    Language
    English
    Official solutions
    Python
    User solutions
    Python