#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &x, U y) {
  if (y < x) x = y;
}
template <typename T, typename U>
inline void amax(T &x, U y) {
  if (x < y) x = y;
}
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  const int MaxLv = 900;
  vector<vector<long double> > dp(2, vector<long double>(MaxLv + 1, 0));
  for (int(j) = (int)(1); (j) <= (int)(MaxLv); ++(j)) dp[n & 1][j] = 0;
  for (int i = n - 1; i >= 0; --i)
    for (int(j) = (int)(1); (j) <= (int)(MaxLv); ++(j)) {
      long double r = 0;
      long double selectedProb = 1.L / k;
      r += (1 - selectedProb) * (dp[i + 1 & 1][j] + 0);
      long double levelupProb = 1.L / (j + 1);
      if (j + 1 <= MaxLv) r += (dp[i + 1 & 1][j + 1] + j * k) / (k * (j + 1));
      r += (1 - levelupProb) * (dp[i + 1 & 1][j] + (j + 1) * k / 2.L) / k;
      dp[i & 1][j] = r;
    }
  long double ans = dp[0 & 1][1];
  printf("%.15f\n", (double)ans);
  return 0;
}
