Enormous Input Test

Practice this coding question on Coding Gurukul.

Problem statement

A data-processing workshop receives a long list of parcel tracking numbers. A scanner assigns a parcel to a special inspection lane whenever its number is divisible by a configured positive integer k. The workshop needs a fast count of qualifying parcels without retaining the entire file. Your task is to implement the divisibility filter used by the scanner. Your task Read n, k and the next n integer values. Count how many values leave remainder zero when divided by k. Each occurrence represents a separate parcel and must be counted separately, even when tracking numbers repeat. Print the final count after all n values have been processed. Important details Zero is divisible by every positive k. The divisor is never zero. The input can be large, so use suitable buffered input and avoid printing an answer for each parcel. Worked example With k = 3 and values [0,3,4,6,7], the qualifying values are 0, 3 and 6. The final count is 3.

Input format

First line: n k. The following input contains n nonnegative integers.

Output format

Print the count of numbers divisible by k.

Constraints

1 <= n <= 1000000; 1 <= k <= 1000000000; each value is 0..1000000000.

Sample input

5 3
0
3
4
6
7

Sample output

3

Sign in to run or submit a solution in C++, Java or Python.