#include <bits/stdc++.h>
using namespace std;
int n, k;
double s1[200010], s2[200010], s3[200010];
double f[52][200010];
int l, r, q[200010];
double g(int x, int num) { return f[num][x] - s3[x] + s2[x] * s1[x]; }
double K(int x, int y, int num) {
  return (g(y, num) - g(x, num)) / (s2[y] - s2[x]);
}
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1, x; i <= n; i++) {
    scanf("%d", &x);
    s1[i] = s1[i - 1] + 1.0 / (0.0 + x);
    s2[i] = s2[i - 1] + 0.0 + x;
    s3[i] = s3[i - 1] + (0.0 + s2[i]) / (0.0 + x);
  }
  for (int i = 1; i <= n; i++) f[1][i] = s3[i];
  for (int j = 2; j <= k; j++) {
    q[l = 0] = j - 1;
    r = 1;
    for (int i = j; i <= n; i++) {
      while (l + 1 < r && K(q[l], q[l + 1], j - 1) < s1[i]) l++;
      int k = q[l];
      f[j][i] = f[j - 1][k] + s3[i] - s3[k] - s2[k] * (s1[i] - s1[k]);
      while (l + 1 < r && K(q[r - 2], q[r - 1], j - 1) >= K(q[r - 1], i, j - 1))
        r--;
      q[r++] = i;
    }
  }
  printf("%.10f\n", f[k][n]);
  return 0;
}
