#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<vector<pair<int, long long> > > G(n);
  int a = n - 1;
  long long sum = 0;
  for (int i = 0; i < (n - 1); ++i) {
    for (int j = 0; j < (a); ++j) {
      int x;
      scanf("%d", &x);
      if (x >= 0) {
        G[i].push_back(make_pair(j + i + 1, x));
        G[j + i + 1].push_back(make_pair(i, x));
        sum += x;
      }
    }
    --a;
  }
  double avg = 0;
  if ((k == 1 && !(n & 1))) {
    for (int i = 0; i < (n); ++i) {
      if (G[i].size() != 1) throw "!!";
      avg += G[i].front().second;
    }
    avg /= n;
  } else if (k == n - 1) {
    avg = 2 * sum;
    avg /= n;
  } else if ((n & 1) && k == 2) {
    int hub = -1;
    for (int i = 0; i < (n); ++i) {
      if ((int)G[i].size() != 2 && (int)G[i].size() != (n - 1)) {
        cerr << "G[i].size()"
                ": "
             << (G[i].size()) << endl;
        cerr << "i"
                ": "
             << (i) << endl;
        throw "!!";
      }
      if (hub != -1 && (int)G[i].size() == (n - 1)) throw "!!";
      if ((int)G[i].size() == (n - 1)) hub = i;
    }
    for (int i = 0; i < (int)(G[hub]).size(); ++i) {
      avg += (n - 2) * G[hub][i].second;
    }
    for (int i = 0; i < (int)(G).size(); ++i) {
      if (i == hub) continue;
      for (int j = 0; j < (int)(G[i]).size(); ++j) {
        avg += G[i][j].second;
      }
    }
    avg /= (n * (n - 1) / 2);
  } else {
    throw "tantrum";
  }
  cout << (long long)(avg + 1e-9) << endl;
  return 0;
}
