#include <fstream>
using namespace std;
int mu(long long m, long long n)
{
	long long tich=1;
	if (n==1)
	return m;
	else 
	return mu(m,n-1)*m;
}
int main ()
{
	ifstream f("DQU.inp");
	ofstream g("DQU.out");  
	long long m,n,p,tong=0;
	f>>m>>n;
	for (p=1;p<=m;p++)
	{
	    mu(p,n); 
	  	tong=tong+mu(p,n);
	}
	g<<tong;
	f.close();
	g.close();
}
