#include <bits/stdc++.h>
using namespace std;
const int N = 2000;
const int mod = 1e9 + 7;
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long n, m;
long long a[N][N];
long long A[N], B[N];
long long MAX;
long long e[N][N];
signed main() {
  cin >> n >> m;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      cin >> a[i][j];
      MAX = max(MAX, a[i][j]);
    }
  A[0] = 0;
  for (long long i = 0; i < m; i++) B[i] = a[0][i] - A[0];
  for (long long i = 1; i < n; i++) A[i] = a[i][0] - B[0];
  long long g = 0;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < m; j++) {
      e[i][j] = abs(a[i][j] - A[i] - B[j]);
      g = gcd(g, e[i][j]);
    }
  if (g <= MAX && g) {
    cout << "NO";
    return 0;
  }
  g += (g == 0) ? MAX + 2 : 0;
  cout << "YES\n" << g << endl;
  for (long long i = 0; i < n; i++) {
    long long x = ceil((double)abs(A[i]) / g);
    A[i] += (A[i] < 0) ? (x * g) : 0;
    cout << A[i] << ' ';
  }
  cout << endl;
  for (long long i = 0; i < m; i++) {
    long long x = ceil((double)abs(B[i]) / g);
    B[i] += (B[i] < 0) ? (x * g) : 0;
    cout << B[i] << ' ';
  }
  return 0;
}
