#include <bits/stdc++.h>
double E[2][555];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int f1 = 0, f2 = 1, mi = 550;
  if (n < mi) mi = n;
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 1; j <= mi; j++)
      E[f1][j] = E[f2][j] * (j * 1. / (j + 1) / k + (k - 1) * 1. / k) +
                 (j * 1. / 2 + j * 1. / (j + 1)) / k +
                 1. / (j + 1) * E[f2][j + 1] / k;
    int t = f1;
    f1 = f2;
    f2 = t;
  }
  printf("%.10f\n", k * E[f2][1]);
  return 0;
}
