#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000000,100000000000")
using namespace std;
const double eps = 1E-9;
const double Exp = 2.718281828459045;
const double Pi = 3.1415926535897932;
const int NMAX = 100 + 5;
const int MMAX = 100000 + 5;
const int INF = 1000000000;
const int BS = 1000000007;
template <typename T>
inline T abs(const T a) {
  if (a < 0) return -a;
  return a;
}
template <typename T>
inline T sqr(const T& a) {
  return a * a;
}
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(a % b, b);
}
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  int i, j;
  cin >> n >> m;
  int w[NMAX][NMAX];
  int a[NMAX];
  int b[NMAX];
  int md = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      cin >> w[i][j];
      md = max(md, w[i][j]);
    }
  }
  md++;
  for (j = 1; j <= m; j++) b[j] = w[1][j];
  a[1] = 0;
  int dif[NMAX];
  int g;
  int rest;
  for (i = 2; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      dif[j] = w[i][j] - w[1][j];
    }
    sort(dif + 1, dif + m + 1);
    rest = dif[1];
    for (j = 2; j <= m; j++) dif[j] -= dif[1];
    dif[1] = 0;
    g = 0;
    for (j = 2; j <= m; j++) {
      g = gcd(g, dif[j]);
    }
    if (g != 0) {
      rest %= g;
    }
    if (rest < 0) rest += g;
    a[i] = rest;
  }
  int cb = 0;
  g = 0;
  for (i = 1; i <= n; i++) {
    for (j = 1; j <= m; j++) {
      if (a[i] + b[j] < w[i][j]) {
        cout << "NO" << endl;
        return 0;
      }
      g = gcd(g, a[i] + b[j] - w[i][j]);
    }
  }
  if (0 == g) g = md;
  if (g < md) {
    cout << "NO" << endl;
    return 0;
  }
  cout << "YES" << endl;
  cout << g << endl;
  for (i = 1; i <= n; i++) {
    a[i] %= g;
    if (a[i] < 0) a[i] += g;
    cout << a[i] << " ";
  }
  cout << endl;
  for (j = 1; j <= m; j++) {
    b[j] %= g;
    if (b[j] < 0) b[j] += g;
    cout << b[j] << " ";
  }
  cout << endl;
  return 0;
}
