#include using namespace std; long mod = 0; int getDublicatedPatterns(int cubes, int colors); int main(){ int n,m; cin >> n; cin >> m; //cout << "n " << n << " m " << m << endl; int numInkBottol = m; int numWanabePainted =n; long patterns = 1; mod = (long)pow(10,9)+7; if (numWanabePainted > numInkBottol) { patterns = getDublicatedPatterns(numWanabePainted,numInkBottol); }else{ //インクの種類が十分多い //順番にインクのバケツにいれる。 for (int i = numInkBottol; i > 0; i--){ patterns = patterns * i; patterns = patterns % mod; } } cout << patterns << endl; } int getDublicatedPatterns(int cubes, int colors){ int ret = 1; for(int i = cubes;i>0;i--){ ret = ret*colors; ret = ret % mod; } //cout << "colors " < 0){ ret = ret - (colors * getDublicatedPatterns(cubes,colors - 1)); } //cout << "colors " <