#include <bits/stdc++.h>
using namespace std;
double D[703][2];
int n, k;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    int p = (i % 2);
    int r = !p;
    for (int j = 1; j <= 700; ++j)
      D[j][p] =
          1.0 / (k * (j + 1)) * (j * D[j][r] + D[j + 1][r] + j * (j + 3) / 2) +
          D[j][r] * (k - 1) / k;
  }
  cout << fixed << setprecision(11) << D[1][n % 2] * k;
  return 0;
}
