#include <bits/stdc++.h>
using namespace std;
long long int c[2020][2020];
int main() {
  long long int n, k, sum = 0;
  cin >> n >> k;
  for (int i = 0; i < ((int)(n)); i++) {
    c[i][i] = -1;
  }
  if (k >= 3) {
    long long int tmp;
    for (int i = 0; i < ((int)(n - 1)); i++) {
      for (int j = (int)(i + 1); j < ((int)(n)); j++) {
        scanf("%I64d", &tmp);
        sum += tmp;
      }
    }
  } else {
    for (int i = 0; i < ((int)(n - 1)); i++) {
      for (int j = (int)(i + 1); j < ((int)(n)); j++) {
        cin >> c[i][j];
        c[j][i] = c[i][j];
        if (c[i][j] > -1) {
          sum += c[i][j];
        }
      }
    }
  }
  if (k != 2) {
    double ress = (double)(sum * 2) / (double)n;
    cout << (long long int)(floor(ress)) << endl;
  } else {
    long long int res = 0;
    for (int i = 0; i < ((int)(n)); i++) {
      vector<long long int> pl;
      for (int j = 0; j < ((int)(n)); j++) {
        if (c[i][j] > -1) pl.push_back(c[i][j]);
      }
      for (int j = 0; j < ((int)(((long long int)(pl).size()))); j++) {
        res += pl[j] * (((long long int)(pl).size()) - 1);
      }
    }
    double ress = (double)(res) / (double)(n * (n - 1) / 2);
    cout << (int)(floor(ress)) << endl;
  }
  return 0;
}
