Module: Dynamic arrays: vector


Problem

3 /8


Insert by condition

Problem

Given an array of N positive elements greater than 1 (2<=N<=100). Insert a value before all elements that are multiples of a
 
Input:
In the first line, N is the number of array elements
The second line contains the number a 
The third line contains N numbers - the values ​​of the array elements
 
Output:
Output the resulting array to a string
 
Example:
Input
5
2
43  50  76  84 100 
 
Output
43 2 50 2 76 2 84 2 100