• + 1 comment

    Smart move to slice, hadn't thought about it. One way to improve your code (because I had the same issue): you need to use the generator expression

    ' '.join(str(s) for s in (arr[d:] + arr[0:d]))
    

    because you applied the int function to your input. Don't do that and it becomes easier:

    n,d = map(int, raw_input().strip().split())
    arr = raw_input().strip().split()
    print ' '.join(arr[d:] + arr[0:d])
    

    Also, I wouldn't mind an if n == d, but that's just my point of view here.