#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int f = 1, ans = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return f * ans;
}
const int MAXN = 1e5 + 11;
double f[2][1001];
int N, K, cur;
int main() {
  N = read(), K = read();
  for (int i = 1; i <= N; i++) {
    cur ^= 1;
    memset(f[cur], 0, sizeof(f[cur]));
    for (int j = 1; j <= 1000; j++) {
      double p1 = (1 / (double)K), p2 = 1 - p1;
      f[cur][j] += ((double)(f[cur ^ 1][j + 1] + j) / (double)(j + 1) +
                    (double)(f[cur ^ 1][j] + (double)(j + 1) / 2) * j /
                        (double)(j + 1)) *
                   p1;
      f[cur][j] += f[cur ^ 1][j] * p2;
    }
  }
  printf("%.10lf\n", f[cur][1] * K);
  return 0;
}
