#include <bits/stdc++.h>
using namespace std;
int n, k, a[2010][2010];
long long sum;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    a[i][i] = -1;
    for (int j = i + 1; j <= n; j++) {
      scanf("%d", &a[i][j]);
      if (a[i][j] != -1) sum += a[i][j];
      a[j][i] = a[i][j];
    }
  }
  if (k != 2) {
    printf("%lld\n", sum * 2 / n);
  } else {
    int q = 0;
    sum = 0;
    for (int i = 1; i <= n; i++) {
      vector<int> v;
      for (int j = 1; j <= n; j++)
        if (a[i][j] != -1) v.push_back(j);
      for (int x = 0; x < v.size(); x++) {
        for (int y = x + 1; y < v.size(); y++) {
          q++;
          sum += a[i][v[x]] + a[i][v[y]];
        }
      }
    }
    printf("%lld\n", sum / q);
  }
  return 0;
}
