#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MAXN = 100'010;
vector<int> g[MAXN];
int din[MAXN], dout[MAXN], tin[MAXN], low[MAXN], timer = 1;
set<int> ans;
void dfs(int u, int p = -1) {
tin[u] = low[u] = timer++;
for (int v : g[u]) {
if (v == p) continue;
if (tin[v]) {
low[u] = min(low[u], tin[v]);
} else {
dfs(v, u);
low[u] = min(low[u], low[v]);
if (low[v] >= tin[u] && p != -1) ans.insert(u);
}
}
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n, m; cin >> n >> m;
for (int i = 0; i < m; i++) {
int u, v; cin >> u >> v;
g[u].emplace_back(v);
g[v].emplace_back(u);
dout[u]++; din[v]++;
}
for (int i = 1; i <= n; i++) {
if (din[i] == 0) {
g[0].emplace_back(i);
g[i].emplace_back(0);
}
if (dout[i] == 0) {
g[i].emplace_back(n+1);
g[n+1].emplace_back(i);
}
}
dfs(0);
cout << ans.size() << "\n";
for (int i : ans) cout << i << " ";
cout << "\n";
}