#include <iostream>
#include <vector>
using namespace std;

const int MOD = 1e9 + 7;

void add(int &a, int b) {
    a = a + b < MOD ? a + b : a + b - MOD;
}

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> dp(M + 1, 1);

    for (int i = 0; i < N; i++)
        for (int m = 0, sum = 0; m <= M; m++) {
            int extra = (sum + int64_t(m) * dp[m]) % MOD;
            add(dp[m], extra);
            add(sum, extra);
        }

    cout << dp[M] << '\n';
}
