#K37592. Minimum Operations to Make Elements Divisible

    ID: 26010 Type: Default 1000ms 256MiB

Minimum Operations to Make Elements Divisible

Minimum Operations to Make Elements Divisible

You are given t test cases. For each test case, you are provided two integers n and k, followed by an array of n integers. Your task is to determine the minimum number of operations required to make every element of the array divisible by k. In each operation, you can change an element so that it becomes divisible by k. Formally, for each element a in the array, you want to satisfy the condition \(a \mod k = 0\). The answer for each test case is the count of elements in the array that do not satisfy this condition.

inputFormat

The input is read from standard input (stdin) and has the following format:

  1. The first line contains an integer t, representing the number of test cases.
  2. For each test case:
    1. The first line contains two integers n and k, where n is the size of the array and k is the divisor.
    2. The second line contains n space-separated integers representing the elements of the array.

outputFormat

For each test case, print a single line to standard output (stdout) containing the minimum number of operations required to make all elements divisible by k.

## sample
3
4 3
4 9 5 10
3 5
1 2 3
5 10
10 20 30 40 50
3

3 0

</p>