#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2000 + 10;
int n, k, d[MAXN];
int c[MAXN][MAXN];
long long f[MAXN], S;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      scanf("%d", &c[i][j]);
      if (c[i][j] >= 0) ++d[i], ++d[j], f[i] += c[i][j], f[j] += c[i][j];
    }
  for (int i = 1; i <= n; ++i)
    if (k == 2)
      S += f[i] * (d[i] - 1);
    else
      S += f[i];
  if (k == 2)
    cout << S * 2 / n / (n - 1) << endl;
  else
    cout << S / n << endl;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
