#include <bits/stdc++.h>
using namespace std;
const long long tam = 100010;
const long long MOD = 1000000007;
const long long MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1);
long long resa[200], resb[200];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  long long ar[n][m], ari[n][m];
  long long mod = -1;
  long long maxo = -1;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> ar[i][j];
      maxo = max(maxo, ar[i][j]);
      if (i == 0) {
        resb[j] = ar[i][j];
      }
    }
  }
  resa[0] = 0;
  for (long long i = 1; i < n; i++) {
    long long pos = -1, neg = 1;
    for (long long j = 0; j < m; j++) {
      if (ar[0][j] > ar[i][j])
        neg = ar[i][j] - ar[0][j];
      else
        pos = ar[i][j] - ar[0][j];
    }
    if (pos != -1 && neg != 1) {
      mod = pos - neg;
      resa[i] = pos;
    } else if (pos != -1)
      resa[i] = pos;
    else
      resa[i] = neg;
  }
  if (mod == -1) mod = maxo + 1;
  for (long long i = 0; i < n; i++)
    if (resa[i] < 0) resa[i] += mod;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      if (ar[i][j] != (resa[i] + resb[j]) % mod) {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n" << mod << '\n';
  for (long long i = 0; i < n; i++) {
    if (i > 0) cout << ' ';
    cout << resa[i];
  }
  cout << '\n';
  for (long long i = 0; i < m; i++) {
    if (i > 0) cout << ' ';
    cout << resb[i];
  }
  cout << '\n';
  return 0;
}
