#include "bits/stdc++.h" using namespace std; #define print(x) cout< PI; typedef pair V; typedef vector VE; const ll mod = 1000000007; int main() { int n; double p; cin>>n>>p; int a[1000001]; for(int i=2;i<=n;i++){ for(int j=i*2;j<=n;j=j+i){ a[j]++; } } double e=0; for(int i=2;i<=n;i++){ if(a[i]==0){e++;} else { e+=1/pow(p,a[i]); } } print(e); }