#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 1e3 + 5;
double dp[2][M];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= min(n, 1000); j++) {
      dp[i & 1][j] =
          1.0 * (k - 1) / k * dp[(i - 1) & 1][j] +
          1.0 / k / (j + 1) * (dp[(i - 1) & 1][j + 1] + j) +
          1.0 * j / k / (j + 1) * (dp[(i - 1) & 1][j] + (1 + j) / 2.0);
    }
  }
  printf("%.10lf", dp[n & 1][1] * k);
}
