CF703E Mishka and Divisors
Description
After playing with her beautiful array, Mishka decided to learn some math. After learning how to multiply, divide and what is divisibility, she is now interested in solving the following problem.
You are given integer $ k $ and array $ a_{1},a_{2},...,a_{n} $ of $ n $ integers. You are to find non-empty subsequence of array elements such that the product of its elements is divisible by $ k $ and it contains minimum possible number of elements.
Formally, you are to find a sequence of indices $ 1
Input Format
The first line of the input contains two integers $ n $ and $ k $ ( $ 1
Output Format
Print single positive integer $ m $ in the first line — the number of elements in desired sequence.
In the second line print $ m $ distinct integers — the sequence of indices of given array elements, which should be taken into the desired sequence.
If there are more than one such subsequence (e.g. subsequence of minimum possible number of elements and with minimum possible sum of elements), you can print any of them.
If there are no such subsequences, print $ -1 $ in the only line.