#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
const int MAXZ = 1000;
int nwin, ntype;
double E[2][MAXN + 1];
void run() {
  scanf("%d%d", &nwin, &ntype);
  int at = 0;
  E[at][0] = 0;
  for (int i = (1); i <= (nwin); ++i)
    E[at][i] = 1.0 * (MAXZ * (MAXZ + 1) / 2 + MAXZ) / ntype / (MAXZ + 1) +
               E[at][i - 1];
  for (int z = MAXZ - 1; z >= 1; --z) {
    at = 1 - at;
    E[at][0] = 0;
    for (int i = (1); i <= (nwin); ++i)
      E[at][i] = 1.0 * (z * (z + 1) / 2 + z + E[1 - at][i - 1] - E[at][i - 1]) /
                     ntype / (z + 1) +
                 E[at][i - 1];
  }
  printf("%.9lf\n", ntype * E[at][nwin]);
}
int main() {
  run();
  return 0;
}
