#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int a[108][108];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  int mod = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      mod = gcd(mod, (a[i][j] - a[i][1]) - (a[1][j] - a[1][1]));
    }
  }
  if (mod < 0) mod = -mod;
  if (mod == 0) mod = inf;
  int flag = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] >= mod) flag = 0;
    }
  }
  if (flag) {
    printf("YES\n");
    printf("%d\n", mod);
    for (int i = 1; i <= n; i++) printf("%d ", a[i][1]);
    printf("\n");
    for (int i = 1; i <= m; i++)
      printf("%d ", ((long long)(a[1][i] - a[1][1]) % mod + mod) % mod);
    printf("\n");
  } else
    printf("NO\n");
  return 0;
}
