#include <bits/stdc++.h>
using namespace std;
vector<int> d[2010];
int main() {
  long long sum = 0;
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = (1); i < (n); ++i) {
    for (int j = (i + 1); j < (n + 1); ++j) {
      int(x);
      scanf("%d", &x);
      if (x >= 0) {
        sum += x;
        d[i].push_back(x);
        d[j].push_back(x);
      }
    }
  }
  if (k == 1 || k == n - 1)
    cout << sum * 2 / n << endl;
  else if (k == 2) {
    long long an = 0;
    for (int i = (1); i < (n + 1); ++i) {
      for (int j = 0; j < (((int)(d[i]).size())); ++j)
        for (int j2 = (j + 1); j2 < (((int)(d[i]).size())); ++j2)
          an += d[i][j] + d[i][j2];
    }
    cout << an / (n * (n - 1) / 2) << endl;
  } else
    while (1)
      ;
  return 0;
}
