#include<bits/stdc++.h>
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,m,k,a,b,c;
    cin >> n >> m >> k;
    vector<int> d[n+1];
    vector<int> u[n+1];
    vector<int> bruh(n+1);
    for(int i = 0; i < m; i++) {
        cin >> a >> b;
        d[a].push_back(b);
        u[b].push_back(a);
    }
    cin >> a >> b;
    queue<int> idk;
    idk.push(a);
    bruh[a] = 1;
    while(!idk.empty()) {
        c = idk.front();
        for(int i = 0; i < d[c].size(); i++) {
            if(bruh[d[c][i]] == 0) {
                bruh[d[c][i]] = 1;
                idk.push(d[c][i]);
            }
        }
        idk.pop();
    }
    idk.push(b);
    bruh[b]+=2;
    while(!idk.empty()) {
        c = idk.front();
        for(int i = 0; i < u[c].size(); i++) {
            if(bruh[u[c][i]] < 2) {
                bruh[u[c][i]] += 2;
                idk.push(u[c][i]);
            }
        }
        idk.pop();
    }
    vector<int> idek(0);
    for(int i = 0; i < n+1; i++ ){
        if(bruh[i] == 3) {
            idek.push_back(i);
        }
    }
    cout << idek.size() << endl;
    for(int i = 0; i < idek.size(); i++) {
        cout << idek[i] << " ";
    }
    return 0;
}
