Problem: You have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the task is xk. 

Output the sum of costs over all non-empty subsets of people.

Input

Only line of input contains two integers N (1 ≤ N ≤ 109) representing total number of people and k (1 ≤ k ≤ 5000).

Output

Output the sum of costs for all non empty subsets modulo 109 + 7.

Examples

Input

1 1


Output

1


Input

3 2


Output

24

Note

In the first example, there is only one non-empty subset {1} with cost 11 = 1.

In the second example, there are seven non-empty subsets.

- {1} with cost 12 = 1

- {2} with cost 12 = 1

- {1, 2} with cost 22 = 4

- {3} with cost 12 = 1

- {1, 3} with cost 22 = 4

- {2, 3} with cost 22 = 4

- {1, 2, 3} with cost 32 = 9

The total cost is 1 + 1 + 4 + 1 + 4 + 4 + 9 = 24.

Solution (in JAVA):

Solution:
import java.io.*;
import java.lang.reflect.Array;
import java.math.*;
import java.text.DecimalFormat;
import java.util.*;




public class Main {
    private static final int mod = 1000000007,MAX = 5000 + 10;
    private static int [][] C;
    private static int [] f;
    private static int add(int a,int b) {
        a += b;
        if(a >= mod) a -= mod;
        if (a < 0) a += mod;
        return a;
    }
    private static int mul(int a,int b) {
        if (a < 0) a += mod;
        if (b < 0) b += mod;
        return (int)((a*(long)b)%mod);
    }
    private static int powmod(int x,int p) {
        if (p == 0) return 1;
        if (x < 0) x += mod;
        int y = 1;
        for (;p > 1;p >>= 1) {
            if (p%2 == 1) y = mul(x,y);
            x = mul(x,x);
        }
        return mul(x,y);
    }
    private static void init(){
        C = new int[MAX][MAX];
        for (int n = 0;n < MAX;n++){
            C[n][0] = C[n][n] = 1;
            for (int k = 1;k < n;k++)
                C[n][k] = add(C[n-1][k],C[n-1][k-1]);
        }
    }
    private static Integer [] nK = new Integer[MAX];

    private static int getPow(int n,int k) {
        if (nK[n] != null) return nK[n];
        return nK[n] = powmod(n,k);
    }
    private static int brute_force(int N,int k) {
        int ret = 0;
        for (int n = 1;n <= N;n++){
            int v = mul(C[N][n],getPow(n,k));
            ret = add(ret,v);
        }
        return ret;
    }
    public static void main(String[] args) throws Exception {
        IO io = new IO(null, null);
        init();
        int N = io.getNextInt(),k = io.getNextInt();
        if (k == 0) io.println(add(powmod(2,N),-1));
        else if (N <= k+1) io.println(brute_force(N,k));
        else{
            f = new int[k + 2];
            for (int n = 1;n <= k+1;n++) {
                int v = brute_force(n, k);
                //f = v/2^(n-k) = v*2^k/2^n
                v = mul(v,powmod(2,k));
                int p2 = powmod(2,n);
                v = mul(v,powmod(p2,mod-2));
                f[n] = v;
            }

            int res = 0;
            for (int i = 1;i <= k+1;i++){
                int A = f[i],B = 1;
                for (int j = 1;j <= k+1;j++) if (i != j) {
                    A = mul(A,N - j);
                    B = mul(B,i - j);
                }
                int tmp = mul(A,powmod(B,mod-2));
                res = add(res,tmp);
            }
            res = mul(res,powmod(2,N-k));
            io.println(res);
        }
        io.close();
    }
}




class IO{
    private BufferedReader br;
    private StringTokenizer st;
    private PrintWriter writer;
    private String inputFile,outputFile;

    public boolean hasMore() throws IOException{
        if(st != null && st.hasMoreTokens()) return true;
        if(br != null && br.ready()) return true;
        return false;
    }
    public String getNext() throws FileNotFoundException, IOException{
        while(st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
        return st.nextToken();
    }

    public String getNextLine() throws FileNotFoundException, IOException{
        return br.readLine().trim();
    }

    public int getNextInt() throws FileNotFoundException, IOException{
        return Integer.parseInt(getNext());
    }
    public long getNextLong() throws FileNotFoundException, IOException{
        return Long.parseLong(getNext());
    }

    public void print(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f" ,x);
    }
    public void println(double x,int num_digits) throws  IOException{
        writer.printf("%." + num_digits + "f\n" ,x);
    }
    public void print(Object o) throws  IOException{
        writer.print(o.toString());
    }

    public void println(Object o) throws  IOException{
        writer.println(o.toString());
    }
    public IO(String x,String y) throws FileNotFoundException, IOException{
        inputFile = x;
        outputFile = y;
        if(x != null) br = new BufferedReader(new FileReader(inputFile));
        else br = new BufferedReader(new InputStreamReader(System.in));
        if(y != null) writer = new PrintWriter(new BufferedWriter(new FileWriter(outputFile)));
        else writer = new PrintWriter(new OutputStreamWriter(System.out));
    }

    protected void close() throws IOException{
        br.close();
        writer.close();
    }
    public void outputArr(Object [] A) throws IOException{
        int L = A.length;
        for (int i = 0;i < L;i++) {
            if(i > 0) writer.print(" ");
            writer.print(A[i]);
        }
        writer.print("\n");
    }
}