#include <bits/stdc++.h>
using namespace std;
double f[51][200001], p[200001], ans, s[200001];
int n, k, i;
int l, r, q[2000001];
double Y(int x) { return f[i - 1][x] - s[x] * p[x]; }
double X(int x) { return s[x]; }
double xl(int x, int y) { return (Y(x) - Y(y)) / (X(x) - X(y)); }
int main() {
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    s[i] = s[i - 1] + x;
    p[i] = p[i - 1] + 1.0 / x;
    ans += (double)s[i] / x;
  }
  for (i = 2; i <= k; i++) {
    l = r = 0;
    for (int j = 1; j <= n; j++) {
      while (l < r && xl(q[l], q[l + 1]) > -p[j]) l++;
      int x = q[l];
      f[i][j] = f[i - 1][x] + s[x] * (p[j] - p[x]);
      while (l < r && xl(q[r], q[r - 1]) < xl(q[r], j)) r--;
      q[++r] = j;
    }
  }
  printf("%.10lf\n", ans - f[k][n]);
  return 0;
}
