링크 : https://www.acmicpc.net/problem/1764
/*
문제 : 듣보잡
링크 : https://www.acmicpc.net/problem/1764
*/
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
map<string, int> m;
vector<string> v;
for(int i = 0; i < N+M; i++){
string s;
cin >> s;
m[s]++;
if(m[s] > 1) v.push_back(s);
}
sort(v.begin(), v.end());
cout << v.size() << '\n';
for(auto i : v) cout << i << '\n';
return 0;
}