#include <bits/stdc++.h>
using namespace std;
const int N = 2000 + 5;
int n, m, deg[N];
long long ans, tot[N];
int main(int argc, char **argv) {
  int x;
  scanf("%d%d", &n, &m);
  for (int i = 1; i < n; ++i)
    for (int j = i + 1; j <= n; ++j) {
      scanf("%d", &x);
      if (~x) ++deg[i], ++deg[j], tot[i] += x, tot[j] += x;
    }
  if (m == 2) {
    for (int i = 1; i <= n; ++i) ans += tot[i] * (deg[i] - 1);
    cout << ans * 2 / (n * (n - 1)) << endl;
  } else {
    for (int i = 1; i <= n; ++i) ans += tot[i];
    cout << ans / n << endl;
  }
  return 0;
}
