given an array of size n make at least k terms equal in minimum operations

operation–> divide a number in the array by d(integer division)

example–>n=4 k=2 d=2

65 33 30 29

ans=3

Explanation:

divide 33 by k 1 times

divide 65 by k 2 times

How to solve this problem can anybody give suggestions.

P.S. :This is question is not from any ongoing contest