#include <bits/stdc++.h>
using namespace std;
int n;
double k, f[2][610];
int read() {
  int x = 0, f = 1, c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x * f;
}
int main() {
  n = read();
  k = 1. * read();
  int now = 1;
  for (int i = n - 1; i >= 0; i--) {
    now ^= 1;
    for (int j = 0; j <= 600; j++)
      f[now][j] = f[now ^ 1][j + 1] / (k * (j + 1)) + j / (2 * k) +
                  j / (k * (j + 1)) +
                  f[now ^ 1][j] * ((1 - 1 / k) + j / (k * (j + 1)));
  }
  printf("%.10lf", k * f[now][1]);
}
