#include <bits/stdc++.h>
using namespace std;
const int NMax = 2100;
int N, K, G[NMax][NMax];
int main() {
  scanf("%d%d", &N, &K);
  long long ret = 0;
  for (int i = 1; i <= N; i++) {
    G[i][i] = -1;
    for (int j = i + 1; j <= N; j++) {
      int first;
      scanf("%d", &first);
      if (first != -1) ret = ret + (long long)first * K * (N - K);
      G[i][j] = G[j][i] = first;
    }
  }
  ret *= 2;
  ret /= (long long)N * (N - 1);
  if (K == 2) {
    ret = 0;
    long long div = 0;
    for (int i = 1; i <= N; i++) {
      int cnt = 0;
      for (int j = 1; j <= N; j++)
        if (G[i][j] != -1) cnt++;
      if (cnt > 1) {
        div += cnt * (cnt - 1) / 2;
        for (int j = 1; j <= N; j++)
          if (G[i][j] != -1) ret += (long long)G[i][j] * (cnt - 1);
      }
    }
    if (div != 0)
      printf("%lld\n", ret / div);
    else
      puts("0");
  } else
    printf("%lld\n", ret);
  return 0;
}
