import scala.io.StdIn.readLine
import scala.collection.mutable.ArrayBuffer

object Main {
  def prefix(p:String) = {
    val m = p.length
    val a = new Array[Int](m)
    var k=0

    a(0) = 0
    for(q<-1 until m) {
      while(k>0 && p(k)!=p(q)) k = a(k-1)
      if(p(k) == p(q)) k = k+1
      a(q) = k
    }

    a
  }

  def main(args:Array[String]) = {
    val t = readLine.trim
    val p = readLine.trim
    val b = new ArrayBuffer[Int]
    var q = 0

    val f = prefix(p)

    for(i<-0 until t.length) {
      while(q>0 && p(q)!=t(i)) q = f(q-1)
      if(p(q)==t(i)) q = q+1
      if(q==p.length) {
        b += i-p.length+1
        q = f(q-1)
      }
    }

    if(b.length>0) println(b.mkString("\n"))
  }
}