#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cstdlib>
using namespace std;
const int MN = 1000111;
char s[MN], t[MN];
int next[MN];
int main() {
scanf("%s\n", &t[1]);
scanf("%s\n", &s[1]);
int j;
j = next[1] = 0;
for(int i = 2; s[i]; ++i) {
while (j > 0 && s[j+1] != s[i]) j = next[j];
if (s[j+1] == s[i]) ++j;
next[i] = j;
}
j = 0;
for(int i = 1; t[i]; ++i) {
while (j > 0 && s[j+1] != t[i]) j = next[j];
if (s[j+1] == t[i]) ++j;
if (s[j+1] == 0) { // Het xau s
printf("%d ", i - j + 1);
j = next[j];
}
}
puts("");
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8Y3N0cmluZz4KI2luY2x1ZGUgPGNzdGRpbz4KI2luY2x1ZGUgPGNzdGRsaWI+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKY29uc3QgaW50IE1OID0gMTAwMDExMTsKCmNoYXIgc1tNTl0sIHRbTU5dOwppbnQgbmV4dFtNTl07CgppbnQgbWFpbigpIHsKICAgIHNjYW5mKCIlc1xuIiwgJnRbMV0pOwogICAgc2NhbmYoIiVzXG4iLCAmc1sxXSk7CgogICAgaW50IGo7CiAgICBqID0gbmV4dFsxXSA9IDA7CiAgICBmb3IoaW50IGkgPSAyOyBzW2ldOyArK2kpIHsKICAgICAgICB3aGlsZSAoaiA+IDAgJiYgc1tqKzFdICE9IHNbaV0pIGogPSBuZXh0W2pdOwogICAgICAgIGlmIChzW2orMV0gPT0gc1tpXSkgKytqOwogICAgICAgIG5leHRbaV0gPSBqOwogICAgfQoKICAgIGogPSAwOwogICAgZm9yKGludCBpID0gMTsgdFtpXTsgKytpKSB7CiAgICAgICAgd2hpbGUgKGogPiAwICYmIHNbaisxXSAhPSB0W2ldKSBqID0gbmV4dFtqXTsKICAgICAgICBpZiAoc1tqKzFdID09IHRbaV0pICsrajsKCiAgICAgICAgaWYgKHNbaisxXSA9PSAwKSB7IC8vIEhldCB4YXUgcwogICAgICAgICAgICBwcmludGYoIiVkICIsIGkgLSBqICsgMSk7CiAgICAgICAgICAgIGogPSBuZXh0W2pdOwogICAgICAgIH0KICAgIH0KICAgIHB1dHMoIiIpOwogICAgcmV0dXJuIDA7Cn0K