#include <algorithm>
#include <climits>
#include <deque>
#include <functional>
#include <iostream>
#include <vector>
#define sz(x) ((int)(x).size())
using namespace std;
const int mod = 1e9 + 7;
const int p = 29;
struct Resid {
int value;
Resid(int val = 0) : value(val) {}
};
vector<Resid> hs, ht, pw;
Resid operator+(const Resid& a, const Resid& b) {
int res = a.value + b.value;
return res < mod ? res : res - mod;
}
Resid operator-(const Resid& a, const Resid& b) {
int res = a.value - b.value;
return res >= 0 ? res : res + mod;
}
Resid operator*(const Resid& a, const Resid& b) {
return int((long long)a.value * b.value % mod);
}
bool operator==(const Resid& a, const Resid& b) {
return a.value == b.value;
}
Resid gethash(int l, int r) {
return hs[r] - hs[l] * pw[r - l];
}
int main() {
string s, t;
cin >> s;
cin >> t;
hs.resize(s.size() + 1);
ht.resize(t.size() + 1);
pw.resize(s.size() + 1);
hs[0] = 0;
ht[0] = 0;
pw[0] = 1;
for (int i = 0; i < s.size(); ++i) {
hs[i + 1] = hs[i] * p + (s[i] - 'a' + 1);
pw[i + 1] = pw[i] * p;
}
for (int i = 0; i < t.size(); ++i) {
ht[i + 1] = ht[i] * p + (t[i] - 'a' + 1);
}
for (int i = 0; i < s.size() - t.size() + 1; ++i) {
if (gethash(i, i + t.size()) == ht[t.size()]) {
cout << i << " ";
}
}
return 0;
}