#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    lint n, m;
    cin >> n >> m;
    vector<vector<vector<lint>>> dp(m + 1, vector<vector<lint>>(n + 1, vector<lint>(n + 1, 0)));
    dp[0][1][1] = 1; // step, visited, scc
    for (lint i = 0; i < m; ++i) {
        for (lint j = 1; j <= n; ++j) {
            for (lint k = 1; k <= j; ++k) {
                if (j != n) {
                    dp[i + 1][j + 1][k] += dp[i][j][k] * (n - j);
                    dp[i + 1][j + 1][k] %= mod;
                }
                dp[i + 1][j][j] += dp[i][j][k] * (k);
                dp[i + 1][j][j] %= mod;
                dp[i + 1][j][k] += dp[i][j][k] * (j - k);
                dp[i + 1][j][k] %= mod;
            }
        }
    }
    cout << dp[m][n][n] << "\n";
    return 0;
}