#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
int n, k;
double f[2][610];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = n; i >= 1; i--) {
    memset(f[i % 2], 0, sizeof f[i % 2]);
    for (int j = 1; j <= min(600, i + 1); j++) {
      f[i % 2][j] += f[(i + 1) % 2][j] * ((double)k - 1) / ((double)k);
      f[i % 2][j] +=
          (f[(i + 1) % 2][j + 1] + ((double)j)) / ((double)k) / ((double)j + 1);
      f[i % 2][j] += (f[(i + 1) % 2][j] * ((double)j) +
                      (((double)j + 1) * ((double)j) / 2.0)) /
                     ((double)k) / ((double)j + 1);
    }
  }
  double ans = f[1][1];
  printf("%0.12f\n", ans * ((double)k));
  return 0;
}
