#include "bits/stdc++.h"

using namespace std;

using i64 = long long;

const i64 MOD = 1e9 + 7;
const i64 INF = i64(1e18) + 7;


template <typename T>
bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}


template <typename T>
struct Matrix{
    static i64 k_;
    int h, w;
    vector<T> v;

    Matrix() : h(1), w(1), v(1, 1){}
    Matrix(int h, int w) : h(h), w(w), v(h * w, -INF){}

    Matrix(vector<vector<T>> v_) : h(v_.size()), w(v_[0].size()), v(h * w){
        for(int i = 0; i < h; ++i)
            for(int j = 0; j < w; ++j)
                v[i * w + j] = v_[i][j];
    }

    static Matrix makeUnit(int n){
        Matrix mat(n, n);
        for(int i = 0; i < n; ++i)
            mat.v[i * n + i] = 0;
        return mat;
    }

    Matrix pow(i64 x){
        assert(h == w);
        auto mat = x & 1 ? *this : makeUnit(h);
        auto u = *this;
        while(u = u * u, x >>= 1)
            if(x & 1)
                mat *= u;
        return mat;
    }

    Matrix operator*(const Matrix& mat){
        assert(w == mat.h);
        Matrix ret(h, mat.w);
        for(int i = 0; i < h; ++i)
            for(int k = 0; k < w; ++k)
                for(int j = 0; j < mat.w; ++j){
                    if(v[i * w + k] < 0 || mat.v[k * mat.w + j] < 0)
                        continue;
                    chmax(ret.v[i * mat.w + j], v[i * w + k] + mat.v[k * mat.w + j]);
                    chmin(ret.v[i * mat.w + j], k_);
                }
        return ret;
    }

    Matrix& operator*=(const Matrix& mat){return *this = *this * mat;}
};


template<> i64 Matrix<i64>::k_ = 0;


signed main(){
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(m), b(m), c(m);
    for(int i = 0; i < m; ++i)
        cin >> a[i] >> b[i] >> c[i];

    vector<vector<int>> dp(n, vector<int>(101, -MOD));
    vector<vector<int>> prev(n, vector<int>(101, -1));
    for(int i = 0; i < n; ++i)
        dp[i][0] = 0;

    for(int j = 0; j < 100; ++j){
        int ma = 0;
        int ma_idx = 0;
        for(int i = 0; i < m; ++i){
            int from = a[i];
            int to = b[i];
            int cost = c[i];
            if(chmax(dp[to][j + 1], dp[from][j] + cost)){
                prev[to][j + 1] = from;
            }
            if(chmax(ma, dp[to][j + 1])){
                ma_idx = to;
            }
        }
        if(ma >= k){
            int p = ma_idx;
            int q = j + 1;
            vector<int> v{p};
            while(q){
                p = prev[p][q];
                v.push_back(p);
                --q;
            }
            cout << j + 1 << endl;
            reverse(v.begin(), v.end());
            for(int i = 0; i < v.size(); ++i)
                cout << v[i] << " \n"[i == v.size() - 1];
            return 0;
        }
    }

    vector<vector<i64>> v(n, vector<i64>(n, -INF));
    for(int i = 0; i < n; ++i)
        v[i][i] = 0;
    for(int i = 0; i < m; ++i){
        chmax(v[a[i]][b[i]], 1LL * c[i]);
    }

    Matrix<i64>::k_ = k;

    auto f = [&](i64 val){
        auto mat = Matrix<i64>(v).pow(val);
        return *max_element(mat.v.begin(), mat.v.end()) >= k;
    };

    i64 ng = 0, ok = k + 1;
    while(ok - ng > 1){
        i64 mid = (ok + ng) / 2;
        (f(mid) ? ok : ng) = mid;
    }

    if(ok == k + 1){
        cout << -1 << endl;
        return 0;
    }
    cout << ok << endl;

}



Measured memory_bytes: 4200