#Python 2, 64 bytes Anonymous function with arguments `n` and `k`, returns the list to output. lambda n,k:[[i,'Shaggy'][`k`in`i`or i%k<1]for i in range(1,n+1)]