#include <bits/stdc++.h>
using namespace std;
int u[2010], a[2010 * 2010], b[2010 * 2010], x[2010 * 2010];
int main() {
  int i, j, n, k, c, l;
  long long s = 0, t;
  l = 0;
  for (scanf("%d%d", &n, &k), i = 0; i < n; i++)
    for (j = i + 1; j < n; j++) {
      scanf("%d", &c);
      if (c != -1) {
        u[i]++;
        u[j]++;
        a[l] = i;
        b[l] = j;
        x[l] = c;
        l++;
      }
    }
  if (k == 1 || k == n - 1) {
    t = n;
    for (i = 0; i < l; s += x[i] * 2, i++)
      ;
  } else if (k == 2 || k == n - 2) {
    t = (long long)n * (n - 1) / 2;
    for (i = 0; i < l; s += (long long)max(u[a[i]], u[b[i]]) * x[i], i++)
      ;
  }
  printf("%I64d\n", s / t);
  return 0;
}
