#include <bits/stdc++.h>
using namespace std;
int n, m, i = 0;
vector<string> v, res, now;
map<pair<string, string>, bool> mp;
void bitMask(int i = 0, string s = "") {
  if (i == n) {
    now.clear();
    for (int i = 0; i < n; i++)
      if (s[i] == '1') {
        now.push_back(v[i]);
        for (int j = 0; j < now.size(); j++) {
          if (mp[make_pair(v[i], now[j])]) return;
        }
      }
    if (now.size() > res.size()) {
      res = now;
    }
  } else if (i > n)
    return;
  bitMask(i + 1, s + '0');
  bitMask(i + 1, s + '1');
}
int main() {
  string first, second;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> first;
    v.push_back(first);
  }
  for (int i = 0; i < m; i++) {
    cin >> first >> second;
    mp[make_pair(first, second)] = 1;
    mp[make_pair(second, first)] = 1;
  }
  bitMask();
  sort(res.begin(), res.end());
  cout << res.size() << "\n";
  for (int i = 0; i < res.size(); i++) cout << res[i] << "\n";
}
