#include <iostream>
#include <string>
#include <vector>
double a[51][6],b[51],c[6];
using namespace std;
int main()
{
    int n, m;
    
    int count = 0;
    while (cin >> n >> m)
    {    
        count = 0;
        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= m; j++)
            {
                cin >> a[i][j];
            }
        }
        // 学生的平均成绩
        for (int i = 1; i <= n; i++)
        {
            double r = 0;
            for (int j = 1; j <= m; j++)
            {
                r = r + a[i][j];
            }
            b[i] = r/m;
        }
        // 课程的平均值成绩
        for (int j = 1; j <= m; j++)
        {
            double col = 0;
            for (int i = 1; i <= n; i++)
            {
                col = col + a[i][j] ;
            }
            c[j] = col/n;
        }
        // 统计学生成绩均大于课程平均成绩的数量
        for (int i = 1; i <= n; i++)
        {
            int k = 0;
            for (int j = 1; j <= m; j++)
            {
                if (a[i][j] >= c[j])
                {
                    k++;
                }
            }
            if (k == m)
            {
                count++;
            }
        }
        // 输出 
        for (int i = 1; i < n; i++)
            printf("%.2lf ", b[i]);
        printf("%.2lf\n", b[n]);
        for (int j = 1; j < m; j++)
            printf("%.2lf ", c[j]);
        printf("%.2lf\n", c[m]);
        printf("%d\n\n", count);
    }
}