#include<bits/stdc++.h>

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)

ll N,M;
ll dp[5050][5050];
ll p2[5555];

ll i, j, k;
ll ans;

int main(){
    scanf("%lld%lld", &N, &M);
    p2[0] = 1;
    fornum(i,0,5050){
        p2[i + 1] = p2[i] * 2 % MOD;
        dp[0][i] = 1;
    }

    fornum(i,0,N){
        ll a = 0, b = 0;
        fornum(j,0,M+1){
            (dp[i + 1][j] += dp[i][j] * (j + 1) + a) %= MOD;
            (a *= 2) %= MOD;
            a += dp[i][j] * j;
            //printf("%lld ", dp[i + 1][j]);
        }
        //printf("\n");
    }
    printf("%lld\n", dp[N][M]);

    return 0;
}