from collections import deque
import sys
def BFS(start, arr, N):
queue = deque([i])
visited = [0] * (N + 1)
visited[i] = True
cnt = 0
while queue:
node = queue.popleft()
for x in arr[node]:
if not visited[x]:
visited[x] = True
cnt += 1
queue.append(x)
return cnt
if __name__ == "__main__":
N, M = map(int, input().split())
arr = [[] for _ in range(N+1)]
maxN = 0
res = []
for i in range(M):
a, b = map(int, input().split())
arr[b].append(a)
for i in range(1, N+1):
ans = BFS(i, arr, N)
if ans > maxN:
maxN = ans
res.clear()
res.append(i)
elif ans == maxN:
res.append(i)
print(*res)
고생 ..