B = 101
DIV = 1<<32
def rolling_hash(s, n)
  hash = Array.new(n+1)
  hash[0] = 0
  n.times{ |i| hash[i+1] = (hash[i]*B + s[i].ord) % DIV }
  hash
end
s = gets.chomp
t = gets.chomp
sl = s.size
tl = t.size
p = Array.new(sl+1)
p[0] = 1
tl.times{ |i| p[i+1] = p[i]*B % DIV }
h1 = rolling_hash(s,sl)
h2 = rolling_hash(t,tl)
(0..(sl-tl)).each do |i|
  p i if (h1[i+tl] - h1[i]*p[tl]) % DIV == h2[tl]
end