#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000;
int n, k, cur;
long double dp[2][MAXN];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = n; i; --i) {
    cur ^= 1;
    int B = 701;
    for (int j = 1; j < B; ++j) {
      dp[cur][j] = (dp[cur ^ 1][j] + (1. + j) / 2) * j;
      dp[cur][j] += (dp[cur ^ 1][j + 1] + j);
      dp[cur][j] /= j + 1;
      dp[cur][j] += dp[cur ^ 1][j] * (k - 1);
      dp[cur][j] /= k;
    }
  }
  long double ans = dp[cur][1] * k;
  printf("%.20f\n", (double)ans);
  return 0;
}
