Function to find ways to arrange K green balls among N balls such that we need exactly i moves to collect all K green balls
def arrange_balls ( n , k ) : NEW_LINE INDENT factorialfun ( ) ; NEW_LINE modinversefun ( ) ; NEW_LINE for i in range ( 1 , k + 1 ) : NEW_LINE INDENT print ( ( binomial ( n - k + 1 , i ) * binomial ( k - 1 , i - 1 ) ) % mod , end = " ▁ " ) ; NEW_LINE DEDENT DEDENT