#include<bits/stdc++.h>
using namespace std;
int k;
int result (int x)
{
    if(x==1) return 1;
    else return pow(x, k)+result(x-1);
}
int main()
{
    ifstream fi("dqu.inp");
    ofstream fo("dqu.out");
    int n;
    fi>>n>>k;
    fo<<result(n);
}
