#include <bits/stdc++.h>
using namespace std;
long long a[110][110], dp[110][110], b[110], k = 1000000000000009, c[110];
int main() {
  long long n, m, ma = -1;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
      ma = max(ma, a[i][j]);
    }
  for (int i = 0; i < n; i++)
    for (int j = 1; j < m; j++) dp[i][j - 1] = a[i][j] - a[i][j - 1];
  for (int j = 0; j < m - 1; j++)
    for (int i = 1; i < n; i++)
      if (dp[i][j] != dp[i - 1][j]) {
        k = max(dp[i][j], dp[i - 1][j]) - min(dp[i][j], dp[i - 1][j]);
        j = m + 1;
        i = n + 1;
      }
  if (k <= ma) {
    cout << "NO" << endl;
    return 0;
  }
  for (int j = 0; j < m - 1; j++)
    for (int i = 1; i < n; i++)
      if (dp[i][j] + k != dp[i - 1][j] && dp[i][j] != dp[i - 1][j] &&
          dp[i - 1][j] + k != dp[i][j]) {
        cout << "NO" << endl;
        return 0;
      }
  b[0] = 0;
  long long o = 0;
  for (int i = 1; i < m; i++) {
    b[i] = b[i - 1] + dp[0][i - 1];
    o = min(o, b[i]);
  }
  for (int i = 0; i < m; i++) {
    b[i] -= o;
  }
  for (int i = 0; i < n; i++) {
    c[i] = a[i][0] - b[0];
    if (c[i] < 0) c[i] += k;
    for (int j = 1; j < m; j++)
      if ((b[j] + c[i]) % k != a[i][j]) {
        cout << "NO" << endl;
        return 0;
      }
  }
  cout << "YES" << endl << k << endl;
  for (int i = 0; i < n; i++) cout << c[i] << " ";
  cout << endl;
  for (int i = 0; i < m; i++) cout << b[i] << " ";
  cout << endl;
  return 0;
}
