#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
#include<numeric>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define PRIM 3
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

Int _pow2[110000];
Int *pow2 = _pow2 + 55000;
Int n, m;
Int dp[5500][5500];
Int dp2[5500][5500];
int main(){
    cin >> n >> m;
    pow2[0] = 1;
    for(int i = 1;i < 54000;i++){
        pow2[i] = pow2[i-1] * 2 % MOD;
        pow2[-i] = pow2[1-i] * ((MOD+1) / 2) % MOD;
    }
    for(int i = 0;i <= n;i++){
        for(int j = 0;j <= m;j++){
            if(i == 0){
                dp[i][j] = 1;
            }
            else{
                dp[i][j] = dp[i-1][j] * (j+1) % MOD;
                if(j >= 2)
                    (dp[i][j] += dp2[i-1][j-1] * pow2[j-1] % MOD) %= MOD;
            }
            if(j)
                (dp2[i][j] = (dp2[i][j-1] + dp[i][j] * j % MOD * pow2[-j] % MOD) % MOD) %= MOD;
        }
    }
    cout << dp[n][m] << endl;
    return 0;
}