#include <bits/stdc++.h>
int n, k;
double f[2][1000];
int main() {
  scanf("%d%d", &n, &k);
  for (register int i = 1; i <= n; i++)
    for (register int j = 1; j < 1000; j++)
      f[i & 1][j] =
          (f[i & 1 ^ 1][j] * (k - 1) +
           ((f[i & 1 ^ 1][j] + (j + 1) / 2.0) * j + f[i & 1 ^ 1][j + 1] + j) /
               (j + 1)) /
          k;
  return printf("%.10lf\n", f[n & 1][1] * k), 0;
}
