#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long OO = 1LL << 61;
const long long MOD = 10007;
const int maxn = 100000 + 5;
double dp[2][600];
int main() {
  int n, k;
  while (scanf("%d %d", &n, &k) != EOF) {
    memset(dp, 0, sizeof dp);
    for (int i = n - 1; i >= 0; i--) {
      for (int j = 1; j < 600; j++) {
        double t1 =
            (1.0 * j * dp[(i + 1) % 2][j] + dp[(i + 1) % 2][j + 1] + 1.0 * j) /
                (j + 1) +
            0.5 * j;
        double t2 = 1.0 * (k - 1) * dp[(i + 1) % 2][j];
        dp[i % 2][j] = (t1 + t2) / k;
      }
    }
    printf("%.10lf\n", k * dp[0][1]);
  }
  return 0;
}
