#include <bits/stdc++.h>
using namespace std;
const int M = 1005;
double n, K, f[2][M], ans;
int main() {
  cin >> n >> K;
  for (int i = 1; i <= n; i++) {
    int x = (i & 1), y = (x ^ 1);
    for (int j = 1; j <= M; j++) {
      f[x][j] = 1.0 * f[y][j] * (K - 1) / K;
      f[x][j] += 1.0 * (f[y][j + 1] + j) * (1.0 / ((j + 1) * K));
      f[x][j] += 1.0 * (f[y][j] + 1.0 * (j + 1) / 2.0) * j / ((j + 1) * K);
    }
  }
  printf("%.10lf\n", f[(int)n & 1][1] * K);
  return 0;
}
