#include <bits/stdc++.h>
using namespace std;
const int MaxN = (int)1e5 + 7;
const int MaxB = (int)7e2;
int n, k;
long double dp[2][MaxB + 7];
int main() {
  scanf("%d", &n);
  scanf("%d", &k);
  int x = 1, y = 0;
  for (int i = 1; i <= n; ++i) {
    x ^= 1;
    y ^= 1;
    for (int j = 1; j <= MaxB; ++j) {
      dp[y][j] =
          (j * dp[x][j] + dp[x][j + 1] + j * (j + 1) / 2 + j) / (k * (j + 1)) +
          dp[x][j] * (k - 1) / k;
    }
  }
  printf("%.9lf", k * (double)dp[y][1]);
  return 0;
}
