#include<bits/stdc++.h>
using namespace std;
int ne[1000001];
int main(){
string a,b;
cin>>a>>b;
int n = a.size(),m = b.size();
string s = b+"#"+a;
for(int i = 1;i<s.size();i++){
int l = ne[i-1];
while(l!=0&&s[i]!=s[l])
l = ne[l-1];
if(s[i]==s[l]){
ne[i] = l+1;
if(ne[i]==m)
printf("%d\n",i-2*m+1);
}
}
for(int i = 0;i<m;i++)
printf("%d ",ne[i]);
}