#include <bits/stdc++.h>
using namespace std;
int n, K, g[2010][2010], cnt[2010];
void read(int &x) {
  char ch = getchar();
  int mark = 1;
  for (; ch != '-' && (ch < '0' || ch > '9'); ch = getchar())
    ;
  if (ch == '-') mark = -1, ch = getchar();
  for (x = 0; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - 48;
  x *= mark;
}
int main() {
  read(n);
  read(K);
  for (int i = 1; i <= n; i++) {
    g[i][i] = -1;
    for (int j = i + 1; j <= n; j++) {
      read(g[i][j]);
      g[j][i] = g[i][j];
    }
  }
  double ans = 0;
  if (K == 1 || K >= 3) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (g[i][j] >= 0) ans += g[i][j];
    printf("%I64d\n", (long long)(ans / n));
  }
  if (K == 2) {
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (g[i][j] >= 0) cnt[i]++;
    for (int i = 1; i <= n; i++)
      for (int j = i + 1; j <= n; j++)
        if (g[i][j] >= 0) ans += (long long)max(cnt[i], cnt[j]) * g[i][j];
    printf("%I64d\n", (long long)(ans * 2 / n / (n - 1)));
  }
  return 0;
}
