#include <bits/stdc++.h>
using namespace std;
map<string, int> nameToInt;
string names[(16 + 1)];
int n, m, forbidden[(16 + 1) * (16 + 1)], bestTeam;
string name;
int nSetBits(int i) { return __builtin_popcount(i); }
int main() {
  int i, j;
  cin >> n >> m;
  for (i = 0; i < n; names[i] = name, ++i) cin >> name;
  sort(names, names + n);
  for (i = 0; i < n; ++i) nameToInt[names[i]] = i;
  for (i = 0; i < m; ++i) {
    forbidden[i] = 0;
    cin >> name;
    forbidden[i] |= 1 << nameToInt[name];
    cin >> name;
    forbidden[i] |= 1 << nameToInt[name];
  }
  for (int i = (1 << n) - 1; i > 0; --i) {
    for (j = 0; j < m; ++j)
      if ((forbidden[j] & i) == forbidden[j]) break;
    if (j == m && nSetBits(bestTeam) < nSetBits(i)) bestTeam = i;
  }
  cout << nSetBits(bestTeam) << endl;
  for (i = 0; i < n; ++i)
    if (bestTeam & (1 << i)) cout << names[i] << endl;
  return 0;
}
