#include<iostream>
using namespace std;
int Next[1000000 + 20];
void setnext(string s) {
if (s.size() == 1) {
Next[0] = -1;
return;
}
Next[0] = -1;
Next[1] = 0;
int cn = 0, i = 2;
while (i <= s.size()) {
if (s[i - 1] == s[cn]) {
Next[i] = cn + 1;
i++;
cn++;
}
else if (cn > 0) {
cn = Next[cn];
}
else {
Next[i] = 0;
i++;
}
}
}
void kmp(string s1, string s2) {
int x = 0, y = 0;
while (x < s1.size()) {
if (s1[x] == s2[y]) {
x++;
y++;
}
else if (y == 0) {
x++;
}
else {
y = Next[y];
}
if (y == s2.size()) {
cout << x - y + 1 << endl;
x = x - y + 1 + 1;
y = 0;
}
}
}
int main() {
string s1, s2;
cin >> s1 >> s2;
setnext(s2);
kmp(s1, s2);
for (int i = 1; i <= s2.size(); i++) {
cout << Next[i] << " ";
}
}