#include <bits/stdc++.h>
using namespace std;
int w[110][110], a[110], b[110];
int k[110][110];
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
int main() {
  vector<int> vt;
  int n, m;
  cin >> n >> m;
  int ii = 0, jj = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) {
      cin >> w[i][j];
      if (w[i][j] < w[ii][jj]) ii = i, jj = j;
    }
  a[ii] = 0;
  for (int i = 0; i < n; ++i) a[i] = w[i][jj] - w[ii][jj];
  for (int j = 0; j < m; ++j) b[j] = w[ii][j];
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int x = a[i] + b[j];
      if (x < w[i][j]) {
        puts("NO");
        return 0;
      }
      if (x == w[i][j]) continue;
      vt.push_back(x - w[i][j]);
    }
  }
  for (int i = 1; i < vt.size(); ++i) vt[0] = gcd(vt[0], vt[i]);
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j)
      if (vt.size() > 0 && (a[i] + b[j]) % vt[0] != w[i][j]) {
        puts("NO");
        return 0;
      }
  puts("YES");
  if (vt.size() > 0)
    printf("%d\n", vt[0]);
  else
    puts("1000000007");
  for (int i = 0; i < n; ++i) printf("%d ", a[i]);
  printf("\n");
  for (int i = 0; i < m; ++i) printf("%d ", b[i]);
  printf("\n");
  return 0;
}
