human
Smallest length of number divisible by K formed by using D only | Function to form the smallest number possible.
Array to mark the remainders counted already.
Iterate over the range.
If that remainder is already found , return - 1.
Driver Code"
How can the above be solved in Python?

Can you provide a code to smallest length of number divisible by K formed by using D only and the other steps required?
assistant
#Here is code to smallest length of number divisible by K formed by using D only and the other steps required.
 def smallest ( k , d ) :
	cnt = 1
	m = d % k
	v = [ 0 for i in range ( k ) ] ;
	v [ m ] = 1
	while ( 1 ) :
		if ( m == 0 ) :
			return cnt
		m = ( ( ( m * ( 10 % k ) ) % k ) + ( d % k ) ) % k
		if ( v [ m ] == 1 ) :
			return - 1
		v [ m ] = 1
		cnt += 1
	return - 1
d = 1
k = 41
print ( smallest ( k , d ) )