#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3fll;
inline int read() {
  register int x = 0, dp = 1;
  register char c = getchar();
  for (; !isdigit(c); c = getchar())
    if (c == '-') dp = -1;
  for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48);
  return x * dp;
}
void write(int x) {
  if (x < 0) x = -x, putchar('-');
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
}
void writeln(int x) {
  write(x);
  puts("");
}
double E[2][600];
int n, k;
int main() {
  memset(E, 0, sizeof(E));
  n = read(), k = read();
  int now = 1;
  for (int i = n - 1; i >= 0; i--) {
    now ^= 1;
    for (int j = 1; j < 600; j++)
      E[now][j] = E[now ^ 1][j] * (j * 1. / (j + 1) / k + (k - 1) * 1. / k) +
                  (j * 1. / 2 + j * 1. / (j + 1)) / k +
                  1. / (j + 1) * E[now ^ 1][j + 1] / k;
  }
  printf("%.9f\n", k * E[now][1]);
  return 0;
}
