#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 2010;
int n, m, w[N][N];
double ret;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) {
    w[i][i] = -1;
    for (int j = i + 1; j < n; j++) scanf("%d", &w[i][j]), w[j][i] = w[i][j];
  }
  for (int i = 0; i < n; i++) {
    int d = 0;
    double s = 0;
    for (int j = 0; j < n; j++)
      if (w[i][j] != -1) d++, s += w[i][j];
    if (d >= m) {
      if (m == 2)
        ret += (d - 1) * s;
      else
        ret += s;
    }
  }
  if (m == 2)
    ret /= n * (n - 1) / 2;
  else
    ret /= n;
  printf("%I64d\n", (long long)floor(ret + 1e-5));
}
