#include <bits/stdc++.h>
using namespace std;
double a[700 + 5], b[700 + 5];
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = n - 1; i >= 0; i--) {
    memset(b, 0, sizeof(b));
    for (int j = 1; j <= 700; j++)
      b[j] = a[j] * (m - 1) / m + (a[j] * j / (j + 1) + 1.0 * j / 2 +
                                   a[j + 1] / (j + 1) + 1.0 * j / (j + 1)) /
                                      m;
    memcpy(a, b, sizeof(b));
  }
  printf("%.10lf\n", a[1] * m);
  return 0;
}
