#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
const int maxn = 110;
int n, m;
long long a[maxn][maxn];
long long aa[maxn];
long long bb[maxn];
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf("%I64d", &a[i][j]);
  long long g = 0;
  for (int i = 0; i < n - 1; i++) {
    for (int j = 0; j < m - 1; j++) {
      long long u =
          abs((a[i + 1][j + 1] - a[i + 1][j]) - (a[i][j + 1] - a[i][j]));
      long long v =
          abs((a[i + 1][j + 1] - a[i][j + 1]) - (a[i + 1][j] - a[i][j]));
      g = gcd(g, gcd(u, v));
    }
  }
  if (g == 0) g = 1000000007;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] >= g) {
        printf("NO");
        return;
      }
  aa[0] = 0;
  bb[0] = a[0][0];
  for (int i = 0; i < n - 1; i++) {
    aa[i + 1] = (g + aa[i] + a[i + 1][0] - a[i][0]) % g;
  }
  for (int j = 0; j < m - 1; j++) {
    bb[j + 1] = (g + bb[j] + a[0][j + 1] - a[0][j]) % g;
  }
  printf("YES\n%d\n", g);
  for (int i = 0; i < n; i++) printf("%d ", aa[i]);
  printf("\n");
  for (int i = 0; i < m; i++) printf("%d ", bb[i]);
}
int main() {
  solve();
  return 0;
}
