#include <bits/stdc++.h>
using namespace std;
const int MXN = 2010;
int ed[MXN][MXN];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int t;
  long long sum = 0;
  for (int i = 0; i < (n); i++) ed[i][i] = -1;
  for (int i = 0; i < (n); i++) {
    for (int j = 0; j < (n - i - 1); j++) {
      scanf("%d", &t);
      ed[i][i + j + 1] = ed[i + j + 1][i] = t;
      if (t != -1) sum += 2 * t;
    }
  }
  int cnt = 0;
  if (k != 2)
    cout << sum / n << endl;
  else {
    sum = 0;
    for (int i = 0; i < (n); i++) {
      for (int j = 0; j < (n); j++) {
        if (ed[i][j] == -1) continue;
        for (int t = j + 1; t < (n); t++) {
          if (ed[i][t] == -1) continue;
          sum += ed[i][j] + ed[i][t];
          cnt++;
        }
      }
    }
    cout << sum / cnt << endl;
  }
  return 0;
}
