#include <bits/stdc++.h>
using namespace std;
long long n, m, w[200][200], b[1 << 10], a[1 << 10];
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  while (a && b) a >= b ? a %= b : b %= a;
  return a + b;
}
long long temp, er, k;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> w[i][j];
  for (int i = 1; i <= m; i++) {
    b[i] = w[1][i];
  }
  for (int i = 1; i <= n; i++) {
    a[i] = w[i][1] - b[1];
  }
  temp = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      temp = gcd(temp, a[i] + b[j] - w[i][j]);
    }
  if (temp != 0) {
    er = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= m; j++)
        if (w[i][j] >= temp) er = 1;
  }
  if (er)
    cout << "NO" << endl;
  else {
    if (temp == 0)
      k = 1000000007;
    else
      k = temp;
    cout << "YES" << endl;
    cout << k << endl;
    for (int i = 1; i <= n; i++) {
      if (i > 1) cout << " ";
      cout << (a[i] + k) % k;
    }
    cout << endl;
    for (int i = 1; i <= m; i++) {
      if (i > 1) cout << " ";
      cout << (b[i] + k) % k;
    }
    cout << endl;
  }
  cin.get();
  cin.get();
  return 0;
}
