#include <bits/stdc++.h>
int n, d;
double f[2][610], g[2][610], F[100010], k;
int cnt, begin;
int main() {
  scanf("%d %lf", &n, &k);
  f[0][1] = k;
  for (register int i = 0; i < n; i++) {
    d ^= 1;
    register int lim = (i + 1 < begin + 200 ? i + 1 : begin + 200) + 1;
    for (register int j = begin; j <= lim; j++) f[d][j] = g[d][j] = 0, cnt++;
    for (register int j = begin; j <= lim; j++) {
      register double t1 = f[d ^ 1][j] / (j + 1) / k,
                      t2 = f[d ^ 1][j] / (j + 1) * j / k;
      f[d][j + 1] += t1;
      g[d][j + 1] += t1 * j;
      f[d][j] += t2;
      g[d][j] += f[d ^ 1][j] * j / 2 / k;
      f[d][j] += f[d ^ 1][j] - t1 - t2;
      cnt++;
    }
    for (register int j = begin; j <= lim; j++) F[i] += g[d][j], cnt++;
    while (f[d][begin] < 1e-16) begin++;
  }
  register double Ans = 0;
  for (register int i = 1; i <= n; i++) F[i] += F[i - 1];
  printf("%0.10lf\n", F[n]);
  return 0;
}
