#include <bits/stdc++.h>
using namespace std;
unsigned long long k, n, i, j, m;
unsigned long long v[105][105];
vector<unsigned long long> l;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) {
      cin >> v[i][j];
      k = max(k, v[i][j]);
    }
  k++;
  if (n == 1) {
    cout << "YES\n";
    cout << k << "\n";
    cout << 0 << "\n";
    for (i = 1; i <= m; i++) cout << v[1][i] << " ";
    cout << "\n";
    return 0;
  }
  if (m == 1) {
    cout << "YES\n";
    cout << k << "\n";
    for (i = 1; i <= n; i++) cout << v[i][1] << " ";
    cout << "\n";
    cout << 0 << "\n";
    return 0;
  }
  unsigned long long a = v[1][1] + v[2][2];
  unsigned long long b = v[1][2] + v[2][1];
  unsigned long long j = max(a, b) - min(a, b);
  if (j == 0) j = k;
  if (k > j) {
    cout << "NO\n";
    return 0;
  }
  k = j;
  unsigned long long x = 0;
  l.push_back(x);
  for (i = 2; i <= n; i++) {
    if (v[i][1] < v[i - 1][1])
      x = (x + k - v[i - 1][1] + v[i][1]) % k;
    else
      x = (x + v[i][1] - v[i - 1][1]) % k;
    l.push_back(x);
  }
  for (i = 0; i < l.size(); i++) {
    for (j = 1; j <= m; j++) {
      if ((l[i] + v[1][j]) % k != v[i + 1][j]) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  cout << k << "\n";
  for (i = 0; i < l.size(); i++) cout << l[i] << " ";
  cout << "\n";
  for (i = 1; i <= m; i++) cout << v[1][i] << " ";
  cout << "\n";
}
