#P1148G. Gold Experience
Gold Experience
No submission language available for this problem.
Description
Consider an undirected graph with vertices. There is a value in each vertex.
Two vertices and are connected with an edge if and only if , where denotes the greatest common divisor (GCD) of integers and .
Consider a set of vertices. Let's call a vertex in this set fair if it is connected with an edge with all other vertices in this set.
You need to find a set of vertices (where is a given integer, ) where all vertices are fair or all vertices are not fair. One can show that such a set always exists.
The first line contains integers and () — the number of vertices and parameter .
The second line contains integers () — the values in the vertices.
Print exactly distinct integers — the indices of the vertices in the chosen set in any order.
Input
The first line contains integers and () — the number of vertices and parameter .
The second line contains integers () — the values in the vertices.
Output
Print exactly distinct integers — the indices of the vertices in the chosen set in any order.
Samples
Note
In the first test case, set is an example of set where no vertices are fair. The vertex does not share an edge with vertex since . The vertex does not share an edge with vertex . The vertex does not share an edge with vertex .
In the second test case, set is an example of a set where all vertices are fair.