def prints(n,k):
    if(n<=0):
        print(n)
    else:
        print(n)
        prints(n-k,k)
        print(n)

n,k=map(int,input().split())        
prints(n,k)

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: