#include <iostream>
constexpr int P = 1000000007, N = 5e3;
int dp[N + 1][N + 1];
int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    int n, m;
    std::cin >> n >> m;
    for (int i = 1; i <= m; ++i)
        dp[0][i] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j)
            dp[i][j] = 1ll * (j + 1) * dp[i - 1][j] % P;
        for (int j = 1, k = 1; j <= m; ++j, k = 1ll * k * (P + 1) / 2 % P)
            dp[i - 1][j] = (dp[i - 1][j - 1] + 1ll * dp[i - 1][j] * j % P * k) % P;
        for (int j = 2, k = 1; j <= m; ++j, k = 2 * k % P)
            dp[i][j] = (dp[i][j] + 1ll * k * dp[i - 1][j - 1]) % P;
    }
    std::cout << dp[n][m] << std::endl;
    return 0;
}