#include <bits/stdc++.h>
using namespace std;
int n, k, et;
long long int ans;
int i, h, j;
long long int sum[3333], numb[3333];
int main() {
  scanf("%d%d", &n, &k);
  et = n * (n - 1) / 2;
  if (k == 1 || k == n - 1) {
    ans = 0;
    for (i = 1; i <= et; i++) {
      scanf("%d", &h);
      if (h == -1) h = 0;
      ans += h;
    }
    printf("%I64d", ans * 2 / n);
    return 0;
  }
  for (i = 1; i <= n; i++)
    for (j = i + 1; j <= n; j++) {
      scanf("%d", &h);
      if (h == -1) continue;
      sum[i] += h;
      sum[j] += h;
      numb[i]++;
      numb[j]++;
    }
  for (i = 1; i <= n; i++) ans += (numb[i] - 1) * sum[i];
  printf("%I64d", ans / et);
  return 0;
}
