#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <array>
#include <bitset> 
#include <unordered_map>
#include <random>
using namespace std;
typedef long long LL;
typedef pair<LL,LL> P;

const long long MOD = 1000000007;

LL C[301][301];
LL dp[301][301][301];
#if 1
// 強連結成分分解
struct Graph {
	vector<vector<int> > es,rs;
	vector<int> rep;
	vector<bool> done;
	void init(int s){
		es.clear();
		es.resize(s);
		rs.clear();
		rs.resize(s);
		rep.clear();
		rep.resize(s);
		for(int i=0;i<s;i++){
			rep[i]=i;
		}
		done.clear();
		done.resize(s);
		order.clear();
	}
	void add(int a,int b){
		es[a].push_back(b);
		rs[b].push_back(a);
	}
	vector<int> order;
	void dfs1(int a){
		done[a]=true;
		for(int b:es[a]){
			if(!done[b]){
				dfs1(b);
			}
		}
		order.push_back(a);
	}
	void dfs2(int a,int r){
		done[a]=false;
		rep[a]=r;
		for(int b:rs[a]){
			if(done[b]){
				dfs2(b,r);
			}
		}
	}

	// 実行
	void exec(){
		for(int i=0;i<es.size();i++){
			if(!done[i]){
				dfs1(i);
			}
		}
		for(int i=order.size()-1;i>=0;i--){
			int v=order[i];
			if(done[v]){
				dfs2(v,v);
			}
		}
	}

	// 親のいないノードの数え上げ
	int countHeads()
	{
		int ret=0;
		vector<bool> hasParent(es.size());
		for(int i=0;i<es.size();i++){
			for(int j:es[i]){
				if(rep[i]!=rep[j]){
					hasParent[rep[j]]=true;
				}
			}
		}
		for(int i=0;i<es.size();i++){
			if(rep[i]==i&&!hasParent[rep[i]]){
				ret++;
			}
		}
		return ret;
	}
};

vector<int> st;
LL solve2(int N,int M)
{
	if(st.size()==M){
		Graph g;
		g.init(N);
		int p=0;
		for(auto q:st){
			g.add(p,q);
			p=q;
		}
		g.exec();
		for(int i=0;i<N;i++){
			if(g.rep[i]!=g.rep[0]){
				return 0;
			}
		}
		Graph h;
		h.init(N);
		int r=0;
		for(int i=0;i<st.size()-1;i++){
			int q=st[i];
			h.add(r,q);
			r=q;
		}
		h.exec();
		int cnt=0;
		for(int i=0;i<N;i++){
			if(h.rep[i]==h.rep[0]){
				cnt++;
			}
		}
		for(auto q:st){
			cout << q << ", ";
		}
		cout << ": " << cnt << endl;
		return 1;
	}
	LL ret=0;
	for(int i=0;i<N;i++){
		st.push_back(i);
		ret+=solve2(N,M);
		st.pop_back();
	}
	return ret;
}
#endif
LL total;
LL f(int m, int n, int c)
{
	if(dp[m][n][c]>=0){
		return dp[m][n][c];
	}

	if(c<=0||n<c){
		return dp[m][n][c]=0;
	}

	if(m==0)
	{
		if(n==1&&c==1){
			return dp[m][n][c]=1;
		}
		else{
			return dp[m][n][c]=0;
		}
	}

	LL ret=0;
	if(n==c){
		for(int k=1;k<=n;k++){
			ret+=f(m-1,n,k)*k%MOD;
			ret%=MOD;
		}
	}
	else{
		ret+=f(m-1,n,c)*(n-c)%MOD;
		ret%=MOD;
		ret+=f(m-1,n-1,c)*(total-(n-1))%MOD;
		ret%=MOD;
	}
	//cerr << m << ", " << n << ", " << c << ": " << ret << endl;
	return dp[m][n][c]=ret;

}
void solve(long long N, long long M){
	memset(dp,-1,sizeof(dp));
	total=N;
	cout << f(M,N,N) << endl;
}
int main(){
#if 0
	memset(dp,-1,sizeof(dp));
	total=3;
	f(3,3,1);
#else
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
	//cout << solve2(N,M) << endl;
	solve(N,M);
#endif


    return 0;
}


Measured memory_bytes: 216708