#include <bits/stdc++.h>
using namespace std;
const int maxN = 111;
long long a[maxN][maxN];
long long ans1[maxN];
long long ans2[maxN];
long long gcd(long long a, long long b) {
  if (a == 0) {
    return b;
  }
  if (b == 0) {
    return a;
  }
  while (b != 0) {
    long long r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long b[maxN][maxN];
int main() {
  int n, m;
  cin >> n >> m;
  long long maxx = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> a[i][j];
      maxx = max(a[i][j], maxx);
      b[i][j] = a[i][j];
    }
  }
  for (int i = 1; i <= n; i++) {
    ans1[i] = a[i][1];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      a[i][j] -= ans1[i];
    }
  }
  long long k = 0;
  for (int j = 2; j <= m; j++) {
    for (int ti = 1; ti <= n; ti++) {
      for (int tj = ti + 1; tj <= n; tj++) {
        long long x = abs(a[ti][j] - a[tj][j]);
        k = gcd(k, x);
      }
    }
  }
  if (k == 0) {
    k = 1e9 + 7;
  }
  for (int j = 1; j <= m; j++) {
    ans2[j] = ((b[1][j] - ans1[1]) % k + k) % k;
  }
  bool f = true;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if ((ans1[i] + ans2[j]) % k != b[i][j]) {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  cout << k << endl;
  for (int i = 1; i <= n; i++) {
    cout << ans1[i] << " ";
  }
  cout << endl;
  for (int j = 1; j <= m; j++) {
    cout << ans2[j] << " ";
  }
  return 0;
}
