Birthday Gift

0

0 votes
Medium
Problem

Lucifer wants an array A of N integers as a birthday gift. But gift was very expensive so his parents gave him a problem and asked him to solve it to get the gift. Given an integer K find the length of smallest segment such that product of numbers in that segment is divisible by K. Lucifer being weak in programming asks you help. Help Lucifer to get his birthday present.

Input
First line contains two integers N and K respectively.
Next line contains N integers separated by a single space.

Constraints
1 <= N <= 105
1 <= value of elements in array <= 1018
1 <= K <= 1018

Time Limit: 2
Memory Limit: 256
Source Limit:
Editor Image

?