Here is the condition of the problem:

Lyuba thought about watering her garden. A garden is a segment of length k. Lyuba has n buckets, the i-th bucket allows you to water a continuous length of garden exactly ai in one hour. Luba can not be watered already watered parts of the garden, as well as you can not water the parts of the earth that are outside the garden.

Lyuba wants to choose one bucket so that he can water the garden as soon as possible. Help her find out the minimum number of hours for which she can do it (as already mentioned, if she chooses a bucket i, she will water a continuous segment of length ai every hour). It is guaranteed that Lyuba can always water the entire garden.

Look at the examples for a better understanding. Input data

The first line contains two integers n and k (1 ≤ n, k ≤ 100) - the number of buckets and the length of the garden.

The next line contains n integers ai (1 ≤ ai ≤ 100) - the length of the segment, which in one hour can be poured with the ith bucket.

It is guaranteed that there will be at least one such bucket with which you can water the entire garden for a whole number of hours. Output

Print a single number - the minimum number of hours for which Lyuba can water the entire garden. Examples:


Input data

3 6 2 3 5

Output

2


Input data

6 7 1 2 3 4 5 6

Output

7

And here is my code:

#include <iostream> using namespace std; int main() { int n, k; cin >> n >> k; int arr [n]; for (int i = 0; i < n - 1; i ++) { cin >> arr [i]; } bool isthere = false; int min; for (int i = 0; i < n; i ++) { if (k % arr [i] == 0) { if (isthere == false) { min = k / arr [i]; isthere = true; } else { if (k / arr [i] < min) { min = k / arr [i]; } } } } cout << min; } 

However, the results do not match. What is wrong here?

1 answer 1

Error in the loop: You already correctly wrote that i = 0 , but incorrectly wrote that i < n - 1 . Remove - 1 , and that's it!

At the point of entry:

 for (int i = 0; i < n; i ++)