#include <bits/stdc++.h>
using namespace std;
int a[120][120], n, m;
long long ans;
const int inf = 2100000000;
inline int gcd(int x, int y) {
  if (x < 0) x = -x;
  if (y < 0) y = -y;
  if (x == 0) return y;
  if (y == 0) return x;
  return gcd(y, x % y);
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      scanf("%d", &a[i][j]);
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 2; j <= m; j++) {
      ans = gcd(ans, (a[i][j] - a[i][1]) - (a[1][j] - a[1][1]));
    }
  }
  if (ans == 0) ans = inf;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] >= ans) {
        printf("NO\n");
        return 0;
      }
    }
  }
  printf("YES\n%d\n", ans);
  for (int i = 1; i <= n; i++) {
    printf("%d ", a[i][1]);
  }
  printf("\n");
  for (int i = 1; i <= m; i++) {
    printf("%d ", (a[1][i] - a[1][1] + ans) % ans);
  }
  return 0;
}
