Gennady and the Bells

Revision en1, by AH-O, 2017-10-20 20:35:42

Gennady were on a tour from "Chittagong" to "Sylhet" to visit a historical Bungalow about 300 years old.There he saw many interesting thing,but the only thing could attack him were some bells.There were several bells in this Bungalow with different color.These bells tinkle after a certain time individually.

Say there were 3 bells.Bell A tinkle after 10 munite later,bell B tinkle after 12 munite later,bell c tinkle after 24 munite later.

But the interesting thing was all bells tinkle together after a certain period according to the time of their individual tinkling.

According to the tinkling time of bell A,B,C — if they tinkle together at 9:30am, they will tinkle together again at 8:30am

After 5 munite of Gennady's arival,the bells tinkled together.Gennady was curious about how many time after the bells would tinkle together? Now you have to help Gennady to find the time of tinkling together.

Input

First line contains 2 integer a,b(2<=a<=100,1<=b<=24) define the number of bells and time of their tinkling together foe the first time(remember it is 24 hour clock time system in Gennady's country)

Second line contains some integers followed by the number of bells, define the time of tinkling of the bells individually.

Output

You have to find,when will the bells tinkle together again.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English AH-O 2021-10-20 18:15:38 81 (published)
en1 English AH-O 2017-10-20 20:35:42 1357 Initial revision (saved to drafts)