#include <bits/stdc++.h>
using namespace std;
int N, K;
double D[2][702];
int main() {
  cin >> N >> K;
  int act = 0;
  for (int i = 1; i <= N; ++i) {
    act = !act;
    memset(D[act], 0, sizeof(D[act]));
    for (int j = 1; j <= min(700, N); ++j)
      D[act][j] = (1.0 / K) * (1.0 / (j + 1)) * (D[!act][j + 1] + j) +
                  (1.0 / K) * (1.0 * j / (j + 1)) * D[!act][j] +
                  (1.0 / K) * (1.0 / (j + 1)) * j * (j + 1) / 2 +
                  (1.0 * (K - 1) / K) * D[!act][j];
  }
  cout << fixed << setprecision(9) << 1.0 * K * D[act][1] << '\n';
}
