#include <bits/stdc++.h>
double dp[2][850];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int t = std::min(n, 800);
  int now = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = t; j >= 1; j--) {
      dp[now][j] =
          dp[now ^ 1][j] * (k - 1) / (1.0 * k) +
          (j * dp[now ^ 1][j] + dp[now ^ 1][j + 1] + j * (j + 3) / 2.0) /
              (1.0 * k * (j + 1));
    }
    now ^= 1;
  }
  printf("%.10f\n", k * dp[now ^ 1][1]);
  return 0;
}
