#include <bits/stdc++.h>
const int N = 525;
int n, k;
double f[2][N + 5];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= N; j++)
      f[i & 1][j] =
          (f[i & 1 ^ 1][j] * ((k - 1) * 1.0 / k) +
           (f[i & 1 ^ 1][j + 1] + j) * (1. / (k * (j + 1))) +
           (f[i & 1 ^ 1][j] + (1 + j) / 2.) * (j * 1. / (k * (j + 1))));
  printf("%.10f\n", f[n & 1][1] * k);
  return 0;
}
