#include <bits/stdc++.h>
int n, m;
long long w[110][110], a[110], b[110];
inline long long gcd(long long p, long long q) {
  return q == 0 ? p : gcd(q, p % q);
}
int main() {
  scanf("%d%d", &n, &m);
  long long mx = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      scanf("%I64d", &w[i][j]);
      if (mx < w[i][j]) mx = w[i][j];
    }
  for (int i = 1; i <= n; i++) a[i] = w[i][1];
  for (int i = 1; i <= m; i++) b[i] = w[1][i] - a[1];
  long long g;
  bool ok = true;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) {
      long long e = a[i] + b[j] - w[i][j];
      if (e < 0) e = -e;
      if (e != 0) {
        if (ok) {
          ok = false;
          g = e;
        } else
          g = gcd(g, e);
      }
    }
  if (ok || g > mx) {
    puts("YES");
    long long mod;
    if (ok)
      mod = mx + 1;
    else
      mod = g;
    printf(
        "%I64d"
        "\n",
        mod);
    for (int i = 1; i <= n; i++)
      printf(
          "%I64d"
          " ",
          (a[i] + mod) % mod);
    printf("\n");
    for (int i = 1; i <= m; i++)
      printf(
          "%I64d"
          " ",
          (b[i] + mod) % mod);
  } else
    puts("NO");
  return 0;
}
