#include <bits/stdc++.h>
using namespace std;
int bestTeam;
void optimize() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int nSetBits(int n) {
  unsigned int count = 0;
  while (n) {
    n &= (n - 1);
    count++;
  }
  return count;
}
int main() {
  optimize();
  map<string, int> nameToInt;
  string name, names[17];
  int i, j, n, m, forbidden[289] = {0};
  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) {
    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) << "\n";
  for (i = 0; i < n; ++i)
    if (bestTeam & (1 << i)) cout << names[i] << "\n";
  return 0;
}
