#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000;
const int T = 600;
double dp[2][T + 10];
int main() {
  int n, k, o = 0, oo;
  cin >> n >> k;
  dp[0][1] = 1;
  double res = 0;
  for (int i = 1; i <= n; i++, o ^= 1) {
    oo = o ^ 1;
    for (int j = 0; j <= T; j++) dp[oo][j + 1] = dp[o][j] / (j + 1) / k;
    for (int j = 0; j <= T; j++)
      dp[oo][j] += dp[o][j] * (1 - 1 / (j + 1.0) / k);
    for (int j = 0; j <= T; j++) res += dp[o][j] * (j / 2.0 + j / (j + 1.0));
    for (int j = 0; j <= T; j++)
      if (dp[oo][j] < 1e-100) dp[oo][j] = 0;
  }
  cout << fixed << setprecision(10) << res << endl;
  return 0;
}
