#include <bits/stdc++.h>
using namespace std;
int a[2003][2003];
double R;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= i; ++j) a[i][j] = -1;
    for (int j = i + 1; j < n; ++j) scanf("%d", &a[i][j]);
  }
  if (k != 2) {
    for (int i = 0; i < n; ++i)
      for (int j = i + 1; j < n; ++j)
        if (a[i][j] != -1) R += a[i][j];
    printf("%I64d", (long long)(R * 2 / n));
  } else {
    for (int i = 0; i < n; ++i) {
      double t = 0;
      for (int j = 0; j < n; ++j)
        if (a[i][j] != -1) {
          ++t;
          a[j][i] = a[i][j];
        }
      --t;
      for (int j = 0; j < n; ++j)
        if (a[i][j] != -1) R += a[i][j] * t;
    }
    printf("%I64d", (long long)(R * 2 / (n * (n - 1))));
  }
  return 0;
}
