#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int B = 800;
int n, k, cur;
double dp[2][B];
int main() {
  scanf("%d%d", &n, &k);
  cur = 0;
  for (int j = 1; j < B; j++) dp[1][j] = 0;
  for (int i = 1; i <= n; i++, cur ^= 1)
    for (int j = 1; j < B; j++)
      dp[cur][j] = dp[cur ^ 1][j] * (k - 1) / k +
                   (j * dp[cur ^ 1][j] + (j + 1 < B ? dp[cur ^ 1][j + 1] : 0) +
                    j * (j + 3) / 2.0) /
                       k / (j + 1);
  printf("%.10lf\n", k * dp[cur ^ 1][1]);
  return 0;
}
