#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ull unsigned long long
#define INF 9223372036854775807
#define M 100000003

signed main()
{
    string s, p;
    cin >> s >> p;

    ull q[s.size() + 1];
    ull h[s.size() + 1];
    q[0] = 1;
    h[0] = 0;
    for (int i = 1; i <= s.size(); i++)
    {
        q[i] = q[i - 1] * M;
        h[i] = h[i - 1] * M + s[i - 1];
    }

    ull ht = 0;

    for (int i = 0; i < p.size(); i++)
        ht = ht * M + p[i];

    for (int i = p.size(); i <= s.size(); i++)
    {
        ull hs = h[i] - h[i - p.size()] * q[p.size()];
        if (hs == ht)
            cout << i - p.size() << endl;
    }
}
