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.
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author beginner1010
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskE solver = new TaskE();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskE {
        final int mod = (int) 1e9 + 7;
        int[][] dp;

        int mul(int a, int b) {
            return (int) ((1L * a * b) % mod);
        }

        int add(int a, int b) {
            long ret = a;
            ret += b;
            ret %= mod;
            if (ret < 0) ret += mod;
            return (int) ret;
        }

        int pow(int a, int b) {
            if (b == 0) return 1;
            if ((b & 1) == 1) return mul(a, pow(a, b - 1));
            else {
                int aux = pow(a, b >> 1);
                return mul(aux, aux);
            }
        }

        int rec(int k, int a, int b) {
            if (k == 0) {
                return pow(2, b);
            }
            if (dp[k][a] != -1) return dp[k][a];
            dp[k][a] = add(mul(a, rec(k - 1, a, b)), mul(b, rec(k - 1, a + 1, b - 1)));
            return dp[k][a];
        }

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            if (n < k) {
                int[][] comb = new int[n + 1][n + 1];
                for (int i = 0; i <= n; i++) {
                    comb[i][i] = comb[i][0] = 1;
                }
                for (int i = 2; i <= n; i++) {
                    for (int j = 1; j < i; j++) {
                        comb[i][j] = add(comb[i - 1][j], comb[i - 1][j - 1]);
                    }
                }
                int ans = 0;
                for (int i = 1; i <= n; i++) {
                    ans = add(ans, mul(comb[n][i], pow(i, k)));
                }
                out.println(ans);
            } else {
                dp = new int[k + 1][k + 1];
                for (int[] aux : dp)
                    Arrays.fill(aux, -1);
                int ans = rec(k, 0, n);
                out.println(ans);
            }
        }

    }

    static class InputReader {
        InputStream is;
        private byte[] inbuf = new byte[1024];
        private int lenbuf = 0;
        private int ptrbuf = 0;
        static final int[] ints = new int[128];

        public InputReader(InputStream is) {
            for (int i = '0'; i <= '9'; i++) ints[i] = i - '0';
            this.is = is;
        }

        public int readByte() {
            if (lenbuf == -1) throw new InputMismatchException();
            if (ptrbuf >= lenbuf) {
                ptrbuf = 0;
                try {
                    lenbuf = is.read(inbuf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (lenbuf <= 0) return -1;
            }
            return inbuf[ptrbuf++];
        }

        public int nextInt() {
            int num = 0, b;
            boolean minus = false;
            while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
            if (b == '-') {
                minus = true;
                b = readByte();
            }

            while (true) {
                if (b >= '0' && b <= '9') {
                    num = (num << 3) + (num << 1) + ints[b];
                } else {
                    return minus ? -num : num;
                }
                b = readByte();
            }
        }

    }
}

