#include <bits/stdc++.h>
using namespace std;
int n = 0;
double k = 0;
double f[2][601] = {0};
int main() {
  scanf("%d%lf", &n, &k);
  for (int i = 1; i <= n; ++i) {
    int x;
    for (int j = 1; j <= 600; ++j) {
      f[i & 1][j] = ((f[i & 1 ^ 1][j] + (double)(j + 1) / 2) * j / (j + 1) +
                     (f[i & 1 ^ 1][j + 1] + j) / (j + 1)) /
                        k +
                    f[i & 1 ^ 1][j] * (1 - (double)1 / k);
    }
  }
  printf("%0.10lf\n", f[n & 1][1] * k);
}
