#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2005;
long long n, k, ans;
vector<pair<long long, long long> > v[maxn];
signed main() {
  scanf("%lld%lld", &n, &k);
  for (long long i = 1; i <= n; i++)
    for (long long j = i + 1; j <= n; j++) {
      long long x;
      scanf("%lld", &x);
      if (x == -1) continue;
      v[i].push_back(make_pair(j, x));
      v[j].push_back(make_pair(i, x));
    }
  if (k == 1) {
    for (long long i = 1; i <= n; i++) ans += v[i][0].second;
    printf("%lld\n", ans / n);
    return 0;
  }
  if (k == 2) {
    for (long long i = 1; i <= n; i++) {
      long long cnt = 0, sum = 0;
      for (long long j = 0; j < v[i].size(); j++) cnt++, sum += v[i][j].second;
      ans += (cnt - 1) * sum;
    }
    printf("%lld\n", ans / (n * (n - 1) / 2));
    return 0;
  }
  for (long long i = 1; i <= n; i++)
    for (long long j = 0; j < v[i].size(); j++) ans += v[i][j].second;
  printf("%lld\n", ans / n);
  return 0;
}
