#include <bits/stdc++.h>
using namespace std;
int n, k;
double f[2][1000];
int main() {
  cin >> n >> k;
  int cur = 1, pre;
  for (int i = 1; i <= n; i++) {
    pre = cur ^ 1;
    for (int j = 1; j <= 800; j++) {
      f[cur][j] =
          1.0 / k / (j + 1) *
              (j * f[pre][j] + 1.0 * j * (j + 1) / 2 + j + f[pre][j + 1]) +
          (1.0 * k - 1) / k * f[pre][j];
    }
    cur ^= 1;
  }
  printf("%.12f\n", k * f[cur ^ 1][1]);
  return 0;
}
