#include <iostream>
#include <set>
#include <vector>
#include <cassert>
using namespace std;
const int nmax = 1e5 + 10;
set<int> forts;
vector<int> g[nmax];
vector<bool> mark;
vector<pair<int, int> > frac;
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
return (a.first * 1LL * b.second - a.second * 1LL * b.first < 0);
}
void dfs(const int u) {
mark[u] = true;
for(int i = 0; i < g[u].size(); ++i) {
int v = g[u][i];
if(not mark[v]) dfs(v);
if(forts.count(v) == 0) frac[u].first++;
frac[u].second++;
}
}
void dfs_runner(int n) {
mark.assign(n, false);
frac.reserve(n);
for(int i = 0; i < n; ++i) {
if(not mark[i]) {
dfs(i);
}
}
}
struct cmpii {
bool operator()(const pair<pair<int, int>, int> &a, const pair<pair<int, int>, int> &b) const {
return cmp(a.first, b.first);
}
};
int main() {
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for(int i = 0; i < k; ++i) {
int x; scanf("%d", &x);
x--;
forts.insert(x);
}
for(int i = 0; i < m; ++i) {
int a, b; scanf("%d%d", &a, &b);
a--; b--;
g[a].push_back(b);
g[b].push_back(a);
}
dfs_runner(n);
multiset<pair<pair<int, int>, int>, cmpii> q;
vector<pair<pair<int, int>, int> > possibles;
for(int i = 0; i < n; ++i) {
if(forts.count(i) == 0) {
q.insert(make_pair(frac[i], i));
} else {
mark[i] = false;
}
}
while(not q.empty()) {
auto iii = *q.begin(); q.erase(q.begin());
possibles.push_back(iii);
int u = iii.second;
mark[u] = false;
for(int i = 0; i < g[u].size(); ++i) {
int v = g[u][i];
if(mark[v]) {
q.erase(q.find(make_pair(frac[v], v)));
assert(frac[v].first >= 1);
frac[v].first--;
q.insert(make_pair(frac[v], v));
}
}
}
int minidx = 0;
for(int i = 0; i < possibles.size(); ++i) {
auto kkk = possibles[minidx];
auto iii = possibles[i];
if(cmp(kkk.first, iii.first)) minidx = i;
}
printf("%d\n", (int)(possibles.size()) - minidx);
for(int i = minidx; i < possibles.size(); ++i) {
printf("%d ", possibles[i].second + 1);
}
return 0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yPGludCwgaW50PiwgaW50PiAmYikgY29uc3QgewogICAgICAgIHJldHVybiBjbXAoYS5maXJzdCwgYi5maXJzdCk7CiAgICB9Cn07CgppbnQgbWFpbigpIHsKICAgIGludCBuLCBtLCBrOwogICAgc2NhbmYoIiVkJWQlZCIsICZuLCAmbSwgJmspOwogICAgZm9yKGludCBpID0gMDsgaSA8IGs7ICsraSkgewogICAgICAgIGludCB4OyBzY2FuZigiJWQiLCAmeCk7CiAgICAgICAgeC0tOwogICAgICAgIGZvcnRzLmluc2VydCh4KTsKICAgIH0KICAgIGZvcihpbnQgaSA9IDA7IGkgPCBtOyArK2kpIHsKICAgICAgICBpbnQgYSwgYjsgc2NhbmYoIiVkJWQiLCAmYSwgJmIpOwogICAgICAgIGEtLTsgYi0tOwogICAgICAgIGdbYV0ucHVzaF9iYWNrKGIpOwogICAgICAgIGdbYl0ucHVzaF9iYWNrKGEpOwogICAgfQogICAgZGZzX3J1bm5lcihuKTsKCiAgICBtdWx0aXNldDxwYWlyPHBhaXI8aW50LCBpbnQ+LCBpbnQ+LCBjbXBpaT4gcTsKICAgIHZlY3RvcjxwYWlyPHBhaXI8aW50LCBpbnQ+LCBpbnQ+ID4gcG9zc2libGVzOwogICAgZm9yKGludCBpID0gMDsgaSA8IG47ICsraSkgewogICAgICAgIGlmKGZvcnRzLmNvdW50KGkpID09IDApIHsKICAgICAgICAgICAgcS5pbnNlcnQobWFrZV9wYWlyKGZyYWNbaV0sIGkpKTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBtYXJrW2ldID0gZmFsc2U7CiAgICAgICAgfQogICAgfQogICAgd2hpbGUobm90IHEuZW1wdHkoKSkgewogICAgICAgIGF1dG8gaWlpID0gKnEuYmVnaW4oKTsgcS5lcmFzZShxLmJlZ2luKCkpOwogICAgICAgIHBvc3NpYmxlcy5wdXNoX2JhY2soaWlpKTsKICAgICAgICBpbnQgdSA9IGlpaS5zZWNvbmQ7CiAgICAgICAgbWFya1t1XSA9IGZhbHNlOwoKICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgZ1t1XS5zaXplKCk7ICsraSkgewogICAgICAgICAgICBpbnQgdiA9IGdbdV1baV07CiAgICAgICAgICAgIGlmKG1hcmtbdl0pIHsKICAgICAgICAgICAgICAgIHEuZXJhc2UocS5maW5kKG1ha2VfcGFpcihmcmFjW3ZdLCB2KSkpOwogICAgICAgICAgICAgICAgYXNzZXJ0KGZyYWNbdl0uZmlyc3QgPj0gMSk7CiAgICAgICAgICAgICAgICBmcmFjW3ZdLmZpcnN0LS07CiAgICAgICAgICAgICAgICBxLmluc2VydChtYWtlX3BhaXIoZnJhY1t2XSwgdikpOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgfQogICAgCiAgICBpbnQgbWluaWR4ID0gMDsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBwb3NzaWJsZXMuc2l6ZSgpOyArK2kpIHsKICAgICAgICBhdXRvIGtrayA9IHBvc3NpYmxlc1ttaW5pZHhdOwogICAgICAgIGF1dG8gaWlpID0gcG9zc2libGVzW2ldOwogICAgICAgIGlmKGNtcChra2suZmlyc3QsIGlpaS5maXJzdCkpIG1pbmlkeCA9IGk7CiAgICB9CiAgICBwcmludGYoIiVkXG4iLCAoaW50KShwb3NzaWJsZXMuc2l6ZSgpKSAtIG1pbmlkeCk7CiAgICBmb3IoaW50IGkgPSBtaW5pZHg7IGkgPCBwb3NzaWJsZXMuc2l6ZSgpOyArK2kpIHsKICAgICAgICBwcmludGYoIiVkICIsIHBvc3NpYmxlc1tpXS5zZWNvbmQgKyAxKTsKICAgIH0KICAgIHJldHVybiAwOwp9Cg==