1, 2, 3, 4, 5, Shaggy
Python 2, 64 63 bytes
Anonymous function with arguments n and k, returns the list to output.
lambda n,k:[[i,'Shaggy'][i%k&lt;1or`k`in`i`]for i in range(1,n+1)]

Alternatively, a function which prints to STDOUT for the same bytecount:
def f(n,k,i=1):exec&quot;print[i,'Shaggy'][i%k&lt;1or`k`in`i`];i+=1;&quot;*n