/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
//ll mod = 1e9 + 7;
//ll MOD = 1e9 + 7;
//ll INF = 1e18;
//const int INF = 7 + (1e+9);
struct SuffixArray
{
    const string s;
    vector<int> SuffixArr;
    vector<int> lcp;

    SuffixArray(const string &str) : s(str)
    {
        construct_suffix_array();
        construct_lcp();
    }

    // Suffix Array の構築
    void construct_suffix_array()
    {
        const int len = s.length();
        vector<int> tmp(len, 0);
        vector<int> rank(len, 0);
        int k;

        SuffixArr.resize(len);
        rank.resize(len);

        for (int i = 0; i < len; ++i)
        {
            SuffixArr[i] = i;
            rank[i] = s[i];
        }

        // ソート比較用関数 ([&] は変数の参照キャプチャ)
        auto compare_sa = [&](int i, int j) {
            if (rank[i] != rank[j])
            {
                return rank[i] < rank[j];
            }
            int ri = (i + k < len) ? rank[i + k] : -1;
            int rj = (j + k < len) ? rank[j + k] : -1;
            return ri < rj;
        };

        for (k = 1; k <= len; k *= 2)
        {
            sort(SuffixArr.begin(), SuffixArr.end(), compare_sa);
            tmp[SuffixArr[0]] = 0;
            for (int i = 1; i < len; ++i)
            {
                int c = compare_sa(SuffixArr[i - 1], SuffixArr[i]) ? 1 : 0;
                tmp[SuffixArr[i]] = tmp[SuffixArr[i - 1]] + c;
            }
            for (int i = 0; i < len; ++i)
            {
                rank[i] = tmp[i];
            }
        }
    }

    // 高さ配列の構築
    void construct_lcp()
    {
        int l = s.length();
        vector<int> rank(l);
        lcp.resize(l);
        for (int i = 0; i < l; ++i)
        {
            rank[SuffixArr[i]] = i;
            lcp[i] = 0;
        }
        for (int i = 0, h = 0; i < l; i++)
        {
            if (rank[i] + 1 < l)
            {
                for (int j = SuffixArr[rank[i] + 1]; max(i, j) + h < SuffixArr.size() && s[i + h] == s[j + h]; ++h)
                    ;
                lcp[rank[i] + 1] = h;
                if (h > 0)
                {
                    --h;
                }
            }
        }
        return;
    }

    // S の s_idx 文字目からの文字列と, P の p_idx 文字目からの文字列の比較
    bool substr_less_than(const string &p, int s_idx = 0, int p_idx = 0)
    {
        int len_s = s.length();
        int len_p = p.length();
        while (s_idx < len_s && p_idx < len_p)
        {
            if (s[s_idx] < p[p_idx])
            {
                return true;
            }
            else if (s[s_idx] > p[p_idx])
            {
                return false;
            }
            s_idx++;
            p_idx++;
        }
        return (s_idx >= len_s) && (p_idx < len_p);
    }

    pair<int, int> lower_upper_bound(string &p)
    {
        int lb, ub;
        auto binary_search = [&](int lo, int hi) {
            while (hi - lo > 1)
            {
                int mid = (hi + lo) / 2;
                if (substr_less_than(p, SuffixArr[mid]))
                {
                    lo = mid;
                }
                else
                {
                    hi = mid;
                }
            }
            return hi;
        };
        // lower_bound
        lb = binary_search(-1, s.length());
        // upper_bound
        p.back()++;
        ub = binary_search(lb - 1, s.length());
        return make_pair(lb, ub);
    }

    void show_output()
    {
        for (int i = 0; i < s.length(); ++i)
        {
            cout << i << " : lcp -> " << lcp[i] << ", suffix -> " << s.substr(SuffixArr[i]) << endl;
        }
    }
};
struct RollingHash
{
    typedef long long lint;
    const string str;
    const lint base, mod;
    vector<lint> hash, pw;

    RollingHash(const string &s, lint h = 1000000007, lint b = 1009) : str(s), mod(h), base(b)
    {
        int l = s.length();
        hash.assign(l + 1, 0);
        pw.assign(l + 1, 0);
        pw[0] = 1;
        for (int i = 0; i < l; ++i)
        {
            pw[i + 1] = pw[i] * base % mod;
            hash[i + 1] = (hash[i] * base + s[i]) % mod;
        }
    }

    lint const get_hash(int l, int r)
    {
        return ((hash[r] - hash[l] * pw[r - l]) % mod + mod) % mod;
    }
};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    RollingHash tree(s,999999733,1009);
    string t;
    cin>>t;
    RollingHash tree2(t,999999733,1009);
    ll t_size = t.size();
    //cout<<t_size<<endl;
    ll key = tree2.get_hash(0,t_size);
    RollingHash tree3("a",999999733,1009);
  //  cout<<tree3.get_hash(0,1)<<endl;
  //  cout<<key<<endl;
    ll res = 0;
    bool h=true;
    rep(j,s.size()-t_size+2){
        ll door = tree.get_hash(j , j + t_size);
        //cout<<door<<endl;
        if(key==door){
           cout<<j<<endl;
           h=false;
        }
    }
  //  if(h)cout<<"The output should be empty."<<endl;
        
    
    
}



Measured memory_bytes: 19692