#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void chkmin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline void chkmax(T &a, T b) {
  if (a < b) a = b;
}
int dis[2100][2100], adj[2100][2100], deg[2100];
int main() {
  int N, K, i, j, k;
  long long sum, cnt;
  scanf("%d%d", &N, &K);
  for (i = 0; i < N; i++) {
    for (j = i + 1; j < N; j++) {
      scanf("%d", &dis[i][j]);
      dis[j][i] = dis[i][j];
      if (dis[i][j] != -1) adj[i][deg[i]++] = j, adj[j][deg[j]++] = i;
    }
  }
  if (K == 2) {
    cnt = sum = 0;
    for (i = 0; i < N; i++) {
      for (j = 0; j < deg[i]; j++)
        for (k = j + 1; k < deg[i]; k++) {
          cnt++;
          sum += dis[i][adj[i][j]] + dis[i][adj[i][k]];
        }
    }
  } else {
    cnt = N;
    sum = 0;
    for (i = 0; i < N; i++)
      for (j = 0; j < N; j++)
        if (i != j && dis[i][j] != -1) sum += dis[i][j];
  }
  printf("%I64d\n", sum / cnt);
  return 0;
}
