#include <bits/stdc++.h>
using namespace std;
int a[111][111], x[111], k;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> a[i][j];
  int in = 0;
  for (int i = 0; i < n; i++)
    if (a[i][0] < a[in][0]) in = i;
  for (int i = 0; i < n; i++) x[i] = a[i][0] - a[in][0];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[in][j] + x[i] < a[i][j]) {
        cout << "NO" << endl;
        return 0;
      } else if (a[in][j] + x[i] > a[i][j]) {
        if (k && (a[in][j] + x[i]) % k != a[i][j]) {
          cout << "NO" << endl;
          return 0;
        }
        k = a[in][j] + x[i] - a[i][j];
      }
  if (!k) k = 2e9;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if ((a[in][j] + x[i]) % k != a[i][j]) {
        cout << "NO" << endl;
        return 0;
      }
  cout << "YES" << endl;
  cout << k << endl;
  for (int i = 0; i < n; i++) cout << x[i] << ' ';
  cout << endl;
  for (int j = 0; j < m; j++) cout << a[in][j] << ' ';
  cout << endl;
  return 0;
}
