Rambo

0

0 votes
Easy
Problem

Rambo is a contract killer and Mr. X is a psychopath.

There is a party of people going on in a town and Mr. X gave Rambo a task to kill atleast Ceil(N/K) people where K is a number that Mr. X hates.

Rambo will be able to kill an individual if the power of his weapon completely divides the power of an individual. So, Rambo decided to take a weapon with maximum possible power that will kill Ceil(N/K) people.

You being the savior of the town needs to have a weapon of power as same as that of Rambo.

Now, You need to find out the power required to kill Rambo.    

 

INPUT:​​​​

  • First line Contains two Positive Integers and K.
  • Second line contains N positive Integers P1,P2,P3.....PN,The power of the individuals in the party.

OUTPUT:

Print a single line Containg a Positive Integer that is power of the weapon required to kill Rambo

CONSTRAINTS:

1N105.

1K5

1Pi1012

 

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the above sample case 8 divides 5 elements of the array (24,8,48,56,16),Which is Ceil(10/3)=4 . There is no number greater than 8 that divides at least 4 numbers of the array. So 8 is the required power to kill Rambo.

Editor Image

?