#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000, maxl = 600;
double f[maxl + 5];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= min(n, maxl); j++)
      f[j] = (f[j + 1] + j) / ((1. + j) * k) +
             (f[j] + 0.5 * (1. + j)) * j / ((1. + j) * k) + f[j] * (k - 1) / k;
  printf("%.10lf", f[1] * k);
}
