AH-O's blog

By AH-O, history, 6 years ago, In English

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

Say there were 3 bells. Bell A tinkle after 10 minutes later, bell B tinkle after 12 minutes later, bell c tinkle after 24 minutes 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:30 am, they will tinkle together again at 8:30 am

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

Input

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

The second line contains some integers followed by the number of bells, defining the time of tinkling of the bells individually.

Output

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

  • Vote: I like it
  • -29
  • Vote: I do not like it

| Write comment?