#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
double dp[2][(40000 + 10)];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int cur = 0, pre = 0;
  for (int i = 1; i <= n; ++i) {
    cur ^= 1;
    for (int j = 0; j < 700; ++j) {
      dp[cur][j] = 1.0 / (k * (j + 1)) *
                       (j * dp[pre][j] + (1 + j) * j / 2 + j + dp[pre][j + 1]) +
                   (1.0 - 1.0 / k) * dp[pre][j];
    }
    pre ^= 1;
  }
  printf("%.15lf\n", k * dp[cur][1]);
}
