#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n, m;
    cin >> n>> m;
    if (n == 1)
        cout << n;
    vector<int>test(n + m - 1);
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < m; j++)
        {
            int X;
            cin >> X;

        }
    }
}