/*
Jackson Simoneau
SI@UCF 2026 - Intro to Competitive Programming
Contest 2

Solution to Shopping List: https://open.kattis.com/problems/shoppinglist
*/

#include <bits/stdc++.h>
using namespace std;

int main() {
    int m, n;
    cin >> m >> n;
    string s;
    map<string, bitset<100>> freq;
    for(int i = 0; i < m; i++) {
        for(int j = 0; j < n; j++) {
            cin >> s;
            freq[s].set(i);
        }
    }

    vector<string> res;
    for(auto it = freq.begin(); it != freq.end(); ++it) {
        if((*it).second.count() == m) res.push_back((*it).first);
    }
    cout << res.size() << endl;
    for(int i = 0; i < res.size(); i++) {
        cout << res[i] << endl;
    }
}