#include <bits/stdc++.h>
int n, k;
double dp[1024], ndp[1024];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; ++i) {
    for (int t = 1; t < 1000; ++t)
      ndp[t] = dp[t] * (k - 1) / k +
               (t * dp[t] + dp[t + 1] + t * (t + 3) / 2) / k / (t + 1);
    for (int t = 1; t < 1000; ++t) dp[t] = ndp[t];
  }
  printf("%.15f\n", k * dp[1]);
  return 0;
}
