import sys
sys.setrecursionlimit(1500)
def dfs(v):
used[v] = True
for u in g[v]:
if not used[u]:
dfs(u)
n, m, k = map(int, input().split())
g = [[] for _ in range(n)]
used = [False] * n
friends = []
for _ in range(m):
u, v = map(int, input().split())
u -= 1
v -= 1
if u > v:
u, v = v, u
if u > 0:
g[u].append(v)
g[v].append(u)
else:
friends.append(v)
for v in list(map(int, input().split())):
dfs(v - 1)
ans = []
for v in friends:
if used[v]:
ans.append(v)
print(len(ans))
for v in sorted(ans):
print(v + 1, end = ' ')