#include <bits/stdc++.h>
int n, k;
long double _ldp[708], _dp[708], *ldp = _ldp, *dp = _dp, E[100086];
int main() {
  scanf("%d%d", &n, &k);
  E[0] = 0;
  memset(dp, 0, sizeof(_dp));
  memset(ldp, 0, sizeof(_dp));
  for (int T = (1); T <= (n); ++T) {
    for (int L = (1); L <= (700); ++L)
      dp[L] = ((L * (ldp[L] + (L + 1) / 2.0) + ldp[L + 1] + L) / (L + 1) +
               ldp[L] * (k - 1)) /
              k;
    E[T] = dp[1];
    std::swap(dp, ldp);
  }
  printf("%.20lf\n", (double)(E[n] * k));
  return 0;
}
