#include <bits/stdc++.h>
using namespace std;
const int Maxn = 805;
double f[2][Maxn + 10], w[Maxn + 10];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  int now = 0, last;
  for (int i = 1; i <= n; ++i) {
    now ^= 1, last = 1 - now;
    ;
    for (int j = 1; j <= Maxn; ++j) {
      f[now][j] = (k - 1.0) * 1.0 / k * f[last][j];
      f[now][j] += 1.0 / k * (j * 1.0 / (j + 1) * (f[last][j] + (1.0 + j) / 2));
      f[now][j] += 1.0 / k * (1.0 / (j + 1) * (f[last][j + 1] + j));
    }
  }
  printf("%.10lf\n", f[now][1] * k);
  return 0;
}
