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