#include <iostream>
#include <cstdio>
#include <cassert>
#include <cstring>
#include <vector>
#include <valarray>
#include <array>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <complex>
#include <random>
#include <bitset>
 
using namespace std;
typedef long long ll;

const ll INF = 1LL<<40;

struct Matrix {
    typedef ll D;
    vector<valarray<D>> d;
    int N, M;
    Matrix(int N, int M) : N(N), M(M) {
        d.resize(N);
        for (int i = 0; i < N; i++) {
            d[i] = valarray<D>(INF, M);
        }
    }

    valarray<D>& operator[](int p) {
        return d[p];
    }

    const valarray<D>& operator[](int p) const {
        return d[p];
    }

    Matrix& operator=(const Matrix &other) {
        copy_n(other.d.begin(), N, d.begin());
        return *this;
    }

    Matrix operator*(const Matrix &right) {
        Matrix res(N, right.M), r(right.M, right.N);
        for (int i = 0; i < right.M; i++) {
            for (int j = 0; j < right.N; j++) {
                r[i][j] = right[j][i];
            }
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < right.M; j++) {
                res[i][j] = min(INF, (d[i]+r[j]).min());
            }
        }
        return res;
    }

    Matrix pow(ll p) {
        Matrix res(N, M), buf = *this;
        for (int i = 0; i < N; i++) res[i][i] = D(0);
        while (p != 0) {
            if (p % 2) {
                res = res*buf;
            }
            buf = buf*buf;
            p /= 2;
        }
        return res;
    }
};

const int MN = 160;

typedef tuple<int, int, ll> T;

ll dist[MN], dist2[MN];
int back[110][MN];

int main() {
    int V, E; ll K;
    cin >> V >> E >> K; V++;
    vector<T> v;
    for (int i = 0; i < E; i++) {
        int a, b; ll c;
        cin >> a >> b >> c;
        v.push_back(T(a, b, -c));
    }
    for (int i = 0; i < V-1; i++) {
        v.push_back(T(V-1, i, 0));
    }

    fill_n(dist, MN, INF);
    dist[V-1] = 0;
    for (int i = 0; i < 101; i++) {
        copy_n(dist, MN, dist2);
        for (T t: v) {
            int a, b; ll c;
            tie(a, b, c) = t;
            if (dist[a] == INF) continue;
            if (dist2[b] < dist[a]+c) continue;
            dist2[b] = dist[a]+c;
            back[i][b] = a;
        }
        copy_n(dist2, MN, dist);

        int f = -1, d = 0;
        for (int j = 0; j < V-1; j++) {
            if (-K < dist[j]) continue;
            if (d < dist[j]) continue;
            d = dist[j];
            f = j;
        }
        if (f == -1) continue;
        cout << i << endl;
        int jj = f;
        vector<int> res;
        res.push_back(jj);
        for (int k = i; k > 0; k--) {
            res.push_back(back[k][jj]);
            jj = back[k][jj];
        }
        reverse(res.begin(), res.end());
        for (int r: res) {
            cout << r << " ";
        } cout << endl;
        return 0;
    }


    Matrix base(V, V);
    for (T t: v) {
        int a, b; ll c;
        tie(a, b, c) = t;
        base[a][b] = min(base[a][b], c);
    }

    int l = 0, r = 2000000;
    while (r-l > 1) {
        int md = (l+r)/2;
        Matrix bb = base.pow(md);
        bool f = false;
        for (int i = 0; i < V; i++) {
            for (int j = 0; j < V; j++) {
                if (bb[i][j] <= -K) {
                    f = true;
                }
            }
        }
//        cout << md << " " << f << endl;
        if (!f) {
            l = md;
        } else {
            r = md;
        }
    }
    if (r == 2000000) {
        cout << -1 << endl;
    } else {
        cout << r << endl;
    }
    return 0;
}