#include<bits/stdc++.h>
using namespace std;
const int MAX=1000000+5;
int main()
{
char s[MAX],t[MAX];
int next[MAX];
scanf("%s\n%s",s,t);
int s_len=strlen(s);
int t_len=strlen(t);
int i=0,j=-1;
next[0]=-1;
while(i<=t_len)
{
if((t[i]==t[j])||j==-1) next[++i]=++j;
else j=next[j];
}
i=0,j=0;
while(i<=s_len)
{
if(s[i]==t[j]||j==-1)
{
i++,j++;
if(j==t_len)
{
printf("%d\n",i-j+1);
j=next[j];
}
}
else j=next[j];
}
return 0;
}