#B4316. Digit Sum Divisibility Check
Digit Sum Divisibility Check
Digit Sum Divisibility Check
Given two positive integers \(n\) and \(m\), followed by \(n\) positive integers, your task is to select those numbers which satisfy the following conditions:
- The number itself is not divisible by \(m\) (i.e. \(x \mod m \neq 0\)).
- The sum of its digits is divisible by \(m\) (i.e. \(\sum{\text{digits}(x)} \mod m = 0\)).
Output the selected numbers in the same order as they appear in the input.
inputFormat
The first line contains two integers \(n\) and \(m\) (where \(1 \leq n \leq 10^5\), \(1 \leq m \leq 100\)).
The second line contains \(n\) positive integers separated by spaces.
outputFormat
Print the numbers that meet the conditions in the same order as they were input. If no number satisfies the conditions, output nothing.
Numbers should be separated by a single space.
sample
5 3
12 13 7 21 14