#include <bits/stdc++.h>
using namespace std;
int n, k, h, r;
long long t[200010], q[200010];
long long s[200010];
double p[200010];
double f[60][200010];
double ans, tot;
double v(long long x, long long y, int i) {
  return (f[i - 1][x] - s[x] * p[x] - f[i - 1][y] + s[y] * p[y]) * 1. /
         (s[y] - s[x]);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &t[i]);
    s[i] = s[i - 1] + t[i];
    p[i] = p[i - 1] + 1. / t[i];
    tot += s[i] * 1. / t[i];
  }
  for (int i = 2; i <= k; i++) {
    h = 0;
    r = 0;
    for (int j = 1; j <= n; j++) {
      while (h < r && v(q[h], q[h + 1], i) < p[j]) h++;
      while (h < r && v(q[r - 1], q[r], i) > v(q[r], j, i)) r--;
      f[i][j] = f[i - 1][q[h]] + s[q[h]] * (p[j] - p[q[h]]);
      q[++r] = j;
    }
  }
  ans = tot - f[k][n];
  printf("%.10lf", ans);
  return 0;
}
