#define _USE_MATH_DEFINES
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using ull = unsigned long long;
using Pi_i = pair<int, int>;
using VB = vector<bool>;
using VC = vector<char>;
using VD = vector<double>;
using VI = vector<int>;
using VLL = vector<ll>;
using VS = vector<string>;
using VSH = vector<short>;
using VULL = vector<ull>;

const int MOD = 1000000007;
const int INF = 1000000000;
const int NIL = -1;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}


class RollingHush1DIndex{
    string field, purpose;
    const ull B = 100000007;
public:
    RollingHush1DIndex(){}
    RollingHush1DIndex(string T, string P): field(T), purpose(P){}
private:
    ull hash(string s){
        int pl = purpose.length();
        ull bp = 1;
        REP(i, pl) bp *= B;
        ull hashed = 0;
        REP(i, pl) hashed = hashed*B + s[i];
        return hashed;
    }
public:
    void setPurpose(string s){
        purpose = s;
    }
    void setField(string s){
        field = s;
    }

    VI getCommonIdx(){
        VI ret;
        int fl = field.length(), pl = purpose.length();
        if(fl < pl) return ret;
        ull bp = 1;
        REP(i, pl) bp *= B;
        ull fh = hash(field), ph = hash(purpose);
        REPS(i, fl-pl){
            if(fh == ph)
                ret.PB(i);
            if(i < fl-pl)
                fh = fh*B + field[i + pl] - field[i]*bp;
        }
        return ret;
    }
};



class RollingHush1DContained{
    string field, purpose;
    unordered_set<ull> sset;
    const ull B = 100000007;
public:
    RollingHush1DContained(){}
    RollingHush1DContained(string T, string P): field(T), purpose(P){
        setSet();
    }
private:
    void setSet(){
        sset.clear();
        int fl = field.length(), pl = purpose.length();
        if(fl >= pl){
            ull bp = 1;
            REP(i, pl) bp *= B;
            ull hashed = hash(field);
            REPS(i, fl-pl){
                sset.insert(hashed);
                if(i < fl-pl)
                    hashed = hashed*B + field[i + pl] - field[i]*bp;
            }
        }
    }
public:
    void setPurpose(string s){
        int prvln = purpose.length();
        purpose = s;
        if(s.length() != prvln)
            setSet();
    }

    void setField(string s){
        field = s;
        setSet();
    }
private:
    ull hash(string s){
        int pl = purpose.length();
        ull bp = 1;
        REP(i, pl) bp *= B;
        ull hashed = 0;
        REP(i, pl) hashed = hashed*B + s[i];
        return hashed;
    }
public:
    bool contain(){
        return sset.find(hash(purpose)) != sset.end();
    }
};


int main(){
    string T, P;
    cin >> T >> P;
    RollingHush1DIndex RH(T, P);
    VI ans = RH.getCommonIdx();
    REP(i, ans.size()){
        cout << ans[i] << endl;
    }
    return 0;
}



Measured memory_bytes: 9892