#include <bits/stdc++.h>
using namespace std;
int N, K;
const int tt = 1200;
double dp[tt + 1];
double sm[tt];
double p1[tt + 1];
int main() {
  scanf("%d%d", &N, &K);
  dp[1] = 1.0;
  for (int(i) = 0; (i) < (tt + 1); (i)++) p1[i] = 1.0 / (i * K);
  int sp = min(tt, N + 3);
  for (int(i) = 0; (i) < (N); (i)++) {
    for (int(j) = 0; (j) < (sp); (j)++) {
      if (dp[j] < 1e-15) dp[j] = 0;
      sm[j] += dp[j];
    }
    for (int j = sp - 1; j > 0; j--) {
      double ad = dp[j - 1] * p1[j];
      dp[j] += ad;
      dp[j - 1] -= ad;
    }
  }
  double res = 0;
  for (int(j) = 0; (j) < (sp); (j)++)
    res += sm[j] * (j) * (j + 3) / (j + j + 2);
  printf("%.12f\n", res);
}
