#include <bits/stdc++.h>
using namespace std;
vector<double> s, sInv, mPref;
double cost(int i, int j) {
  if (j < i) return 0;
  i--;
  j--;
  assert(i >= 0 && j >= 0);
  if (i == 0) return mPref[j];
  i--;
  return mPref[j] - mPref[i] - s[i] * (sInv[j] - sInv[i]);
}
const int maxK = 55;
const int maxN = 200500;
double F[maxK][maxN];
int P[maxK][maxN];
void fill(int g, int l1, int l2, int p1, int p2) {
  if (l1 > l2) return;
  int lm = (l1 + l2) >> 1;
  P[g][lm] = -1;
  F[g][lm] = 1e18;
  for (int k = p1; k <= p2; k++) {
    double new_cost = F[g - 1][k] + cost(k + 1, lm);
    if (F[g][lm] > new_cost) {
      F[g][lm] = new_cost;
      P[g][lm] = k;
    }
  }
  fill(g, l1, lm - 1, p1, P[g][lm]);
  fill(g, lm + 1, l2, P[g][lm], p2);
}
int main() {
  int n, k;
  scanf("%d %d", &n, &k);
  vector<int> a(n);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  s.resize(n);
  sInv.resize(n);
  mPref.resize(n);
  for (int i = 0; i < n; i++) {
    s[i] = (i ? s[i - 1] : 0) + a[i];
    sInv[i] = (i ? sInv[i - 1] : 0) + 1.0 / a[i];
  }
  double s = 0, m = 0;
  for (int i = 0; i < n; i++) {
    s += a[i];
    m += s / a[i];
    mPref[i] = m;
  }
  for (int l = 0; l <= n; l++) {
    F[1][l] = cost(1, l);
    P[1][l] = 0;
  }
  for (int g = 2; g <= k; g++) {
    fill(g, 0, n, 0, n);
  }
  printf("%f\n", F[k][n]);
  return 0;
}
