#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  if (max(a, b) == 0) return 0;
  if (a == 0) return b;
  long long gcd = a;
  while (b % gcd) {
    a = gcd;
    gcd = b % gcd;
    b = a;
  }
  return gcd;
}
int main() {
  long long int i, j, n, m, big = 0;
  cin >> n >> m;
  long long matrix[n][m];
  for (i = 0; i < n; ++i)
    for (j = 0; j < m; ++j) {
      cin >> matrix[i][j];
      big = max(big, matrix[i][j]);
    }
  if (n == 1) {
    cout << "YES\n" << big + 1 << "\n" << 0 << "\n";
    for (j = 0; j < m; ++j) cout << matrix[0][j] << " ";
    return 0;
  }
  if (m == 1) {
    cout << "YES\n" << big + 1 << "\n";
    for (j = 0; j < n; ++j) cout << matrix[j][0] << " ";
    cout << "\n0";
    return 0;
  }
  long long changed[n][m - 1];
  for (i = 0; i < n; ++i)
    for (j = 0; j < m - 1; ++j) changed[i][j] = matrix[i][j + 1] - matrix[i][0];
  long long final[n - 1][m - 1], g = 0;
  for (i = 0; i < n - 1; ++i)
    for (j = 0; j < m - 1; ++j) {
      final[i][j] = changed[i + 1][j] - changed[0][j];
      g = gcd(g, final[i][j]);
    }
  if (g == 0) g = LONG_MAX;
  if (g <= big) {
    cout << "NO";
    return 0;
  }
  cout << "YES\n" << g << "\n";
  for (i = 0; i < n; ++i) {
    if (matrix[i][0] < 0)
      cout << g + matrix[i][0] % g << " ";
    else
      cout << matrix[i][0] % g << " ";
  }
  cout << "\n0 ";
  for (i = 0; i < m - 1; ++i) {
    if (changed[0][i] < 0)
      cout << g + changed[0][i] % g << " ";
    else
      cout << changed[0][i] % g << " ";
  }
  cout << "\n";
  return 0;
}
