#include <bits/stdc++.h>
using namespace std;

const int maxn = 5050, P = 1000000007;
int n, m, f[maxn][maxn];

int main() {
    scanf("%d %d", &n, &m);
    fill(f[0] + 1, f[0] + m + 1, 1);
    for (int i = 1; i <= n; i++) {
        int sum = 0;
        for (int j = 1; j <= m; j++) {
            f[i][j] = (1LL * (j + 1) * f[i - 1][j] + sum) % P;
            sum = (2LL * sum + 1LL * j * f[i - 1][j]) % P;
        }
    }
    printf("%d\n", f[n][m]);
    return 0;
}