B = 1000000007
DIV = 1<<64
def rolling_hash(s, n)
  hash = Array.new
  hash << 0
  (0...n).each{ |i| hash << (hash.last*B + s[i].ord) % DIV }
  hash
end
s = gets.chomp
t = gets.chomp
sl = s.size
tl = t.size
p = Array.new
p << 1
(0...sl).each{ |i| p << p.last*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