// Imports
import java.util.*;
import java.io.*;

public class blackboard {

    static HashMap<Long, Integer> primes = new HashMap<>();

    static long modInverse(long a, long m)
    {
        long m0 = m;
        long y = 0, x = 1;

        if (m == 1)
            return 0;

        while (a > 1)
        {
            // q is quotient
            long q = a / m;

            long t = m;

            // m is remainder now, process
            // same as Euclid's algo
            m = a % m;
            a = t;
            t = y;

            // Update x and y
            y = x - q * y;
            x = t;
        }

        // Make x positive
        if (x < 0)
            x += m0;

        return x;
    }

    static class Fraction {
        public long numerator;
        public long denominator;

        static long gcd(long a, long b) {
            if(a < 0 || b < 0) {
                System.out.println("!!!" + a + " " + b);
            }

            if(a == 0) {
                return b;
            }
            if(b == 0) {
                return a;
            }

            // Everything divides 0
            while (a != b) {

                if (a > b) {
                    a = a - b;
                }
                else {
                    b = b - a;
                }

            }
            return a;
        }

        public Fraction(long n, long d) {
            numerator = n;
            denominator = d;
        }

        public void simplify() {
            long divisor = gcd(numerator, denominator);
            numerator /= divisor;
            denominator /= divisor;
        }

        public Fraction multiply(Fraction other) {
            long n = this.numerator * other.numerator;
            long d = this.denominator * other.denominator;
            long divisor = gcd(n, d);
            n /= divisor;
            d /= divisor;

            return new Fraction(n, d);
        }

        public Fraction add(Fraction other) {
            long n = Math.abs(this.numerator * other.denominator +  other.numerator * this.denominator);
            long d = this.denominator * other.denominator;
            long divisor = gcd(n, d);
            n /= divisor;
            d /= divisor;

            return new Fraction(n, d);
        }

        public Fraction divide(long div) {
            long gcf = gcd(div, this.numerator);

            return new Fraction(this.numerator/gcf, this.denominator*(div/gcf));
        }

        @Override
        public String toString() {
            return this.numerator + "/" + this.denominator;
        }

    }

    // method to print the divisors
    public static List<Long> getDivisors(long n)
    {
        List<Long> divisors = new ArrayList<Long>();

        // Note that this loop runs till square root
        for (long i = 1; i <= Math.sqrt(n); i++)
        {
            if (n%i==0)
            {
                // If divisors are equal, print only one
                if (n/i == i) {
                    divisors.add(i);
                }
                else {
                    divisors.add(n/i);
                    divisors.add(i);
                }
            }
        }

        return divisors;
    }

    public static void loadPrimeFactorization(long n) {
        if(n%2 == 0) {
            if(primes.containsKey((long)2)) {
                primes.put((long)2, primes.get((long)2) + 1);
                loadPrimeFactorization(n/2);
            }
            else {
                primes.put((long)2, 1);
                loadPrimeFactorization(n/2);
            }
        }
        else {
            for(long i = 3; i <= Math.sqrt(n); i++) {
                if(n%i == 0) {
                    if(primes.containsKey(i)) {
                        primes.put(i, primes.get(i) + 1);
                        loadPrimeFactorization(n/i);
                        return;
                    }
                    else {
                        primes.put(i, 1);
                        loadPrimeFactorization(n/i);
                        return;
                    }
                }
            }

            if(n != 1) {
                if(primes.containsKey(n)) {
                    primes.put(n, primes.get(n) + 1);
                }
                else {
                    primes.put(n, 1);
                }
            }
        }
    }

    /**
     * @param args the command line arguments
     * @throws IOException, FileNotFoundException
     */
    public static void main(String[] args) throws IOException, FileNotFoundException {

        final long MOD = (long) 1E9 + 7;

        // TODO UNCOMMENT WHEN ALGORITHM CORRECT
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        // BufferedReader f = new BufferedReader(new StringReader("60 5"));

        // TODO code application logic here
        StringTokenizer st = new StringTokenizer(f.readLine());
        long n = Long.parseLong(st.nextToken());
        int d = Integer.parseInt(st.nextToken());

        primes = new HashMap<>();
        loadPrimeFactorization(n);

        // System.out.println(primes);

        Fraction totalExpect = new Fraction(1, 1);

        for(long i : primes.keySet()) {
            // Probability after i steps the number is p^j
            Fraction[][] dp = new Fraction[d + 1][primes.get(i) + 1];
            dp[0][primes.get(i)] = new Fraction(1, 1);
            for(int j = 0; j < primes.get(i); j++) {
                dp[0][j] = new Fraction(0, 1);
            }

            // System.out.println(Arrays.toString(dp[0]));

            for(int j = 1; j < dp.length; j++) {
                for(int k = dp[0].length - 1; k >= 0; k--) {
                    // f(i, j) = f(i, j+1) + f(i - 1, j)/(j + 1)
                    if(k + 1 == dp[0].length) {
                        dp[j][k] = dp[j - 1][k].divide(k + 1);
                    }
                    else {
                        // System.out.println(dp[j - 1][k]);
                        // System.out.println(dp[j - 1][k].divide(j + 1));
                        dp[j][k] = dp[j][k + 1].add(dp[j - 1][k].divide(k + 1));
                    }
                    // System.out.println(dp[j][k] + " " + k + " " + dp[0].length);
                }
            }

            // System.out.println(Arrays.deepToString(dp));

            // System.out.println("done!");

            // Compute expected value
            Fraction expected = new Fraction(0, 1);
            for(int j = 0; j < dp[0].length; j++) {
                // System.out.println(Math.pow(i, j));
                expected = expected.add(dp[d][j].multiply(new Fraction((long)Math.pow(i, j), 1)));
            }

            // System.out.println(expected);

            totalExpect = totalExpect.multiply(expected);
            totalExpect.simplify();
        }

        /*
        List<Long> divisors = getDivisors(n);
        Collections.sort(divisors);

        SortedMap<Long, List<Long>> hm = new TreeMap<>();

        for(long i : divisors) {
            List<Long> div = getDivisors(i);
            hm.put(i, div);
        }

        // System.out.println(hm);

        // int[][] dp = new int[]
        // DP[i][j] i = divisor, j = lenght
        System.out.println(divisors.size() + " " + d);
        Fraction[][] dp = new Fraction[divisors.size()][d];
        for(int i = 0; i < dp.length; i++) {
            dp[i][0] = new Fraction(0, 1);
            long current = divisors.get(i);
            for(long j : hm.get(current)) {
                dp[i][0].add(new Fraction(j, 1));
            }
            // System.out.println(dp[i][0] + " " + hm.get(current).size());
            dp[i][0].divide(hm.get(current).size());
            // System.out.println(dp[i][0]);
            dp[i][0].simplify();

            for(int j = 1; j < dp[0].length; j++) {
                dp[i][j] = new Fraction(0, 1);
                for(long k : hm.get(current)) {
                    dp[i][j].add(dp[divisors.indexOf(k)][j - 1]);
                }
                // System.out.println(dp[i][j]);
                dp[i][j].divide(hm.get(current).size());
                dp[i][j].simplify();
            }
            // System.out.println(Arrays.toString(dp[i]));
        }

        // System.out.println(Arrays.deepToString(dp));

        // System.out.println(dp[divisors.size() - 1][d - 1].numerator + "/" + dp[divisors.size() - 1][d - 1].denominator);

        // denominator inverse ax congruent 1 (mod 1000000007)
        long inverse = modInverse(dp[divisors.size()-1][d - 1].denominator, MOD);
        // System.out.println(inverse);

        System.out.println((inverse*dp[divisors.size()-1][d-1].numerator)%MOD);

        */

        // Prime factorize the number

        // denominator inverse ax congruent 1 (mod 1000000007)
        long inverse = modInverse(totalExpect.denominator, MOD);
        // System.out.println(inverse);

        System.out.println((inverse*totalExpect.numerator)%MOD);
    }

}


// Imports
import java.util.*;
import java.io.*;
import java.math.BigInteger;

public class blackboardbackup {

    static HashMap<Long, Integer> primes = new HashMap<>();

    static long modInverse(long a, long m)
    {
        long m0 = m;
        long y = 0, x = 1;

        if (m == 1)
            return 0;

        while (a > 1)
        {
            // q is quotient
            long q = a / m;

            long t = m;

            // m is remainder now, process
            // same as Euclid's algo
            m = a % m;
            a = t;
            t = y;

            // Update x and y
            y = x - q * y;
            x = t;
        }

        // Make x positive
        if (x < 0)
            x += m0;

        return x;
    }

    static class Fraction {
        public long numerator;
        public long denominator;

        static long gcd(long a, long b) {
            if(a < 0 || b < 0) {
                System.out.println("!!!" + a + " " + b);
            }

            // Everything divides 0
            while (a != b) {

                if(a == 0) {
                    return b;
                }
                if(b == 0) {
                    return a;
                }

                if (a > b) {
                    long floor = a/b;
                    a = a - (b*floor);
                }
                else {
                    long floor = b/a;
                    b = b - (a*floor);
                }

            }
            return a;
        }

        public Fraction(long n, long d) {
            numerator = n;
            denominator = d;
        }

        public void simplify() {
            long divisor = gcd(numerator, denominator);
            numerator /= divisor;
            denominator /= divisor;
        }

        public Fraction multiply(Fraction other) {
            this.simplify();
            other.simplify();

            long div = gcd(this.numerator, other.denominator);
            long div2 = gcd(this.denominator, other.numerator);
            long n1 = this.numerator / div;
            long n2 = other.numerator / div2;
            long d1 = other.denominator / div;
            long d2 = this.denominator / div2;

            long n = n1 * n2;
            long d = d1 * d2;
            long divisor = gcd(n, d);
            n /= divisor;
            d /= divisor;

            return new Fraction(n, d);
        }

        public Fraction add(Fraction other) {
            this.simplify();
            other.simplify();

            // long time = System.currentTimeMillis();
            long dengcd = gcd(this.denominator, other.denominator);
            // System.out.println("TIME GCD: " + (System.currentTimeMillis() - time));
            long lcm = this.denominator / dengcd;
            lcm *= other.denominator;

            long currden = lcm / this.denominator;
            long otherden = lcm / other.denominator;

            long n = otherden * other.numerator + currden * this.numerator;

            Fraction ret = new Fraction(n, lcm);
            ret.simplify();

            return ret;
        }

        public Fraction divide(long div) {
            long time = System.currentTimeMillis();
            long gcf = gcd(div, this.numerator);
            System.out.println("TIME GCD: " + (System.currentTimeMillis() - time));

            return new Fraction(this.numerator/gcf, this.denominator*(div/gcf));
        }

        @Override
        public String toString() {
            return this.numerator + "/" + this.denominator;
        }

    }

    // method to print the divisors
    public static List<Long> getDivisors(long n)
    {
        List<Long> divisors = new ArrayList<Long>();

        // Note that this loop runs till square root
        for (long i = 1; i <= Math.sqrt(n); i++)
        {
            if (n%i==0)
            {
                // If divisors are equal, print only one
                if (n/i == i) {
                    divisors.add(i);
                }
                else {
                    divisors.add(n/i);
                    divisors.add(i);
                }
            }
        }

        return divisors;
    }

    public static void loadPrimeFactorization(long n) {
        if(n%2 == 0) {
            if(primes.containsKey((long)2)) {
                primes.put((long)2, primes.get((long)2) + 1);
                loadPrimeFactorization(n/2);
            }
            else {
                primes.put((long)2, 1);
                loadPrimeFactorization(n/2);
            }
        }
        else {
            for(long i = 3; i <= Math.sqrt(n); i++) {
                if(n%i == 0) {
                    if(primes.containsKey(i)) {
                        primes.put(i, primes.get(i) + 1);
                        loadPrimeFactorization(n/i);
                        return;
                    }
                    else {
                        primes.put(i, 1);
                        loadPrimeFactorization(n/i);
                        return;
                    }
                }
            }

            if(n != 1) {
                if(primes.containsKey(n)) {
                    primes.put(n, primes.get(n) + 1);
                }
                else {
                    primes.put(n, 1);
                }
            }
        }
    }

    /**
     * @param args the command line arguments
     * @throws IOException, FileNotFoundException
     */
    public static void main(String[] args) throws IOException, FileNotFoundException {

        final long MOD = (long) 1E9 + 7;

        // TODO UNCOMMENT WHEN ALGORITHM CORRECT
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));

        // BufferedReader f = new BufferedReader(new StringReader("60 5"));

        // TODO code application logic here
        StringTokenizer st = new StringTokenizer(f.readLine());
        long n = Long.parseLong(st.nextToken());
        int d = Integer.parseInt(st.nextToken());

        primes = new HashMap<>();
        loadPrimeFactorization(n);

        System.out.println(primes);

        long ans = 1;

        // 2 times
        for(long i : primes.keySet()) {
            // Probability after i steps the number is p^j
            long[][] dp = new long[d + 1][primes.get(i) + 1];
            // System.out.println(dp.length + " " + dp[0].length);

            dp[0][primes.get(i)] = 1;
            for(int j = 0; j < primes.get(i); j++) {
                dp[0][j] = 0;
            }

            // System.out.println(Arrays.toString(dp[0]));

            for(int j = 1; j < dp.length; j++) {
                long sum = 0;
                for(int k = dp[0].length - 1; k >= 0; k--) {
                    long inverse = modInverse((long)(k + 1), MOD);
                    inverse = (inverse * dp[j][k])%MOD;
                    sum += inverse;
                    sum %= MOD;
                    dp[j+1][k] = sum;
                    dp[j+1][k] %= MOD;
                }
            }

            // System.out.println(Arrays.deepToString(dp));

            // System.out.println("done!");

            // Compute expected value
            long expected = 0;
            long current = 1;
            for(int j = 0; j < dp[0].length; j++) {
                // System.out.println(Math.pow(i, j));
                expected += (current*dp[d][j]) % MOD;
                expected %= MOD;
                current *= i;
                current %= MOD;
            }

            // System.out.println(expected);
            ans *= expected;
            ans %= MOD;
        }

        /*
        List<Long> divisors = getDivisors(n);
        Collections.sort(divisors);

        SortedMap<Long, List<Long>> hm = new TreeMap<>();

        for(long i : divisors) {
            List<Long> div = getDivisors(i);
            hm.put(i, div);
        }

        // System.out.println(hm);

        // int[][] dp = new int[]
        // DP[i][j] i = divisor, j = lenght
        System.out.println(divisors.size() + " " + d);
        Fraction[][] dp = new Fraction[divisors.size()][d];
        for(int i = 0; i < dp.length; i++) {
            dp[i][0] = new Fraction(0, 1);
            long current = divisors.get(i);
            for(long j : hm.get(current)) {
                dp[i][0].add(new Fraction(j, 1));
            }
            // System.out.println(dp[i][0] + " " + hm.get(current).size());
            dp[i][0].divide(hm.get(current).size());
            // System.out.println(dp[i][0]);
            dp[i][0].simplify();

            for(int j = 1; j < dp[0].length; j++) {
                dp[i][j] = new Fraction(0, 1);
                for(long k : hm.get(current)) {
                    dp[i][j].add(dp[divisors.indexOf(k)][j - 1]);
                }
                // System.out.println(dp[i][j]);
                dp[i][j].divide(hm.get(current).size());
                dp[i][j].simplify();
            }
            // System.out.println(Arrays.toString(dp[i]));
        }

        // System.out.println(Arrays.deepToString(dp));

        // System.out.println(dp[divisors.size() - 1][d - 1].numerator + "/" + dp[divisors.size() - 1][d - 1].denominator);

        // denominator inverse ax congruent 1 (mod 1000000007)
        long inverse = modInverse(dp[divisors.size()-1][d - 1].denominator, MOD);
        // System.out.println(inverse);

        System.out.println((inverse*dp[divisors.size()-1][d-1].numerator)%MOD);

        */

        // Prime factorize the number

        // denominator inverse ax congruent 1 (mod 1000000007)
        System.out.println(ans);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;

public class c {

	public static class Prob
	{
		long num, den;
		Prob(long num, long den)
		{
			long gcd = gcd(Math.max(num, den), Math.min(num, den));
			this.num = num/gcd;
			this.den = den/gcd;
		}
	}

	public static class Number
	{
		long val;
		Prob p;
		int level;
		Number(long val, long num, long den,int level)
		{
			this.val = val;
			this.p = new Prob(num, den);
			this.level = level;
		}
	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		long mod = 1000000007;
		//System.out.println(inverse(4, 19));
		FastReader s = new FastReader();
		long N = s.nextLong();
		int k =s .nextInt();

		Number num = new Number(N, 1, 1, 0);
		Queue<Number> queue = new LinkedList<>();

		queue.add(num);
		HashMap<Long, ArrayList<Long>> factors = new HashMap<>();

		Prob ans = new Prob(0,1);
		while(!queue.isEmpty())
		{
			Number temp = queue.remove();
			if(temp.level == k)
			{
				ans = addProb(ans,multiply(temp.p, temp.val));
			}

			else
			{
				ArrayList<Long> fac_list;
				if(factors.containsKey(temp.val))
					fac_list = factors.get(temp.val);
				else
				{
					fac_list = getFactors(temp.val);
					factors.put(temp.val, fac_list);
				}

				//System.out.println(fac_list+" "+temp.val);
				for(int i=0;i<fac_list.size();i++)
				{
					Number n = new Number(fac_list.get(i), temp.p.num, temp.p.den * fac_list.size(), temp.level + 1);
					queue.add(n);
					//System.out.println(n.val+" "+n.level+" added");
				}
			}
		}

		//System.out.println(ans.num+" "+ans.den);
		System.out.println(((ans.num)%mod*inverse(ans.den,mod))%mod);

    }

	public static long inverse(long r2, long r1)
	{
		long mod = r1;
		long t1 = 0, t2 = 1;
		while(r2 > 0)
		{
			long q = r1/r2;
			long r = r1%r2;
			r1 = r2;
			r2 = r;

			long t = t1 - q *t2;
			t1 = t2;
			t2 = t;
		}

		return (t1 + mod)%mod;
	}

	public static Prob multiply( Prob p, long num)
	{
		long n = p.num * num;
		return new Prob(n/gcd(Math.max(n, p.den), Math.min(n, p.den)),p.den/gcd(Math.max(n, p.den), Math.min(n, p.den)));
	}
	public static ArrayList<Long> getFactors(long num)
	{
		//System.out.println("called for"+num);
		ArrayList<Long> factors = new ArrayList<>();

		for(long val = 1;val*val <= num;val++)
		{
			if(num%val == 0)
			{
				factors.add(val);
				if(num/val != val)
				factors.add(num/val);
			}
		}

		//System.out.println(factors);
		return factors;

	}

	public static Prob addProb(Prob p1, Prob p2)
	{
		long base = lcm(p1.den, p2.den);
		long num = p1.num*(base/p1.den)+ p2.num * (base/p2.den);
		long gcd = gcd(Math.max(num, base), Math.min(num, base));

		return new Prob(num/gcd, base/gcd);
	}

	public static long lcm(long val1, long val2)
	{
		return val1 * val2 /(gcd(Math.max(val1, val2),Math.min(val1, val2)));
	}

	public static long gcd(long val1, long val2)
	{
	    if(val2 == 0)
	    	return val1;
	    else
	    	return gcd(val2, val1%val2);
	}

		static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Map.Entry;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class DMakotoAndABlackboard {
        final static long MOD = MathExtensions.DEFAULT_MOD;
        long[] factorial;
        long[] invFactorial;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            final long n = in.NextInt();
            final int k = in.NextInt();

            long[][] fifi = MathExtensions.Factorials.getFactorialAndInverseFactorialsAndInverse_O_N(k + 1, MOD);
            factorial = fifi[0];
            invFactorial = fifi[1];

            HashMap<Integer, Integer> divisors = getAllDivisors(n);
            long res = 1;
            for (Map.Entry<Integer, Integer> e : divisors.entrySet()) {
                final long p = e.getKey();
                long newRes = 0;
                final int repeats = e.getValue();
                final long[] probabilityOfCount = getProbability(repeats, k);
                for (int count = 0; count <= repeats; count++) {
//                final long probabilityOfSingleInstanceToBePresented = MathExtensions.powerMod(MathExtensions.modInverse_For_M_Prime(2, MOD), k, MOD);
//                final long probabilityOfSingleInstanceToNotBePresented = (1 - probabilityOfSingleInstanceToBePresented + MOD) % MOD;
//                final long probabilityOfSingleInstanceOfCount = (
//                        MathExtensions.powerMod(probabilityOfSingleInstanceToBePresented, count, MOD) *
//                                MathExtensions.powerMod(probabilityOfSingleInstanceToNotBePresented, repeats - count, MOD)) % MOD;
//                final long probabilityOfCount = probabilityOfSingleInstanceOfCount * nChooseK(repeats, count) % MOD;

                    final long currentInfluence = MathExtensions.powerMod(p, count, MOD);
                    newRes += (currentInfluence % MOD) * probabilityOfCount[count] % MOD;
                    newRes %= MOD;
                    if (newRes < 0) newRes += MOD;
                }
                res = res * newRes % MOD;
            }
            out.println(res);
        }

        private long[] getProbability(int start, int k) {
            long[][] probability = new long[2][start + 1];
            int p = 0;
            probability[p][start] = 1;
            while (k-- > 0) {
                p ^= 1;
                long[] cur = probability[p];
                long[] last = probability[p ^ 1];
                Arrays.fill(cur, 0);
                for (int j = 0; j <= start; j++) {
                    long currentProb = last[j] * MathExtensions.modInverse_For_M_Prime(j + 1, MOD) % MOD;
                    for (int i = 0; i <= j; i++) {
                        cur[i] += currentProb;
                        cur[i] %= MOD;
                    }
                }
            }
            return probability[p];
        }

        private HashMap<Integer, Integer> getAllDivisors(long n) {
            HashMap<Integer, Integer> res = new HashMap<>();
            int p = 2;
            n = handle(p, res, n);
            p = 3;
            while (p <= n) {
                n = handle(p, res, n);
                p += 2;
            }
            return res;
        }

        private long handle(int p, HashMap<Integer, Integer> res, long n) {
            int count = 0;
            while (n % p == 0) {
                n /= p;
                count++;
            }
            if (count != 0) res.put(p, count);

            return n;
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int NextInt() {
            return Integer.parseInt(next());
        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(Writer out) {
            super(out);
        }

        public OutputWriter(File file) throws FileNotFoundException {
            super(file);
        }

        public OutputWriter(OutputStream out) {
            super(out);
        }

    }

    static class MathExtensions {
        public static final long DEFAULT_MOD = 1_000_000_007L;

        public static long modInverse_For_M_Prime(final long a, final long m) {
            return powerMod(a, m - 2, m);
        }

        public static long powerMod(final long x, final long y, final long m) {
            if (y == 0)
                return 1;

            long p = powerMod(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

        public static class InverseModulo {
            public static long[] getInverseModulo(final int max, final long MOD) {
                // Why is it workingggg!?!?!? need to read about this!
                long[] inv = new long[max + 1];
                if (max == 0) return inv;
                inv[1] = 1;
                for (int i = 2; i <= max; i++) {
                    inv[i] = (MOD - MOD / i) * inv[(int) (MOD % i)] % MOD;
                }
                return inv;
            }

        }

        public static class Factorials {
            public static long[][] getFactorialAndInverseFactorialsAndInverse_O_N(int max, long MOD) {
                assert max >= 0;
                long[] fact = new long[max + 1];
                long[] ifact = new long[max + 1];
                long[] inv = MathExtensions.InverseModulo.getInverseModulo(max, MOD);
                fact[0] = 1;
                ifact[0] = 1;
                for (int i = 1; i <= max; i++) {
                    fact[i] = fact[i - 1] * i % MOD;
                    ifact[i] = ifact[i - 1] * inv[i] % MOD;
                }
                return new long[][]{fact, ifact, inv};
            }

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.StringTokenizer;
import java.util.Map;
import java.util.Map.Entry;
import java.io.Writer;
import java.io.BufferedReader;
import java.io.InputStream;

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

    static class DMakotoAndABlackboard {
        final static long MOD = MathExtensions.DEFAULT_MOD;
        long[] inv;

        public void solve(int testNumber, InputReader in, OutputWriter out) {
            final long n = in.NextLong();
            final int k = in.NextInt();
            inv = new long[70];
            for (int i = 1; i < 70; i++) {
                inv[i] = MathExtensions.modInverse_For_M_Prime(i, MOD);
            }

            HashMap<Long, Integer> divisors = getAllDivisors(n);
            long res = 1;
            for (Map.Entry<Long, Integer> e : divisors.entrySet()) {
                final long p = e.getKey() % MOD;
                long newRes = 0;
                final int repeats = e.getValue();
                final long[] probabilityOfCount = getProbability(repeats, k);
                long currentInfluence = 1;
                for (int count = 0; count <= repeats; count++) {
                    newRes += (currentInfluence % MOD) * probabilityOfCount[count] % MOD;
                    newRes %= MOD;
                    if (newRes < 0) newRes += MOD;
                    currentInfluence = currentInfluence * p % MOD;
                }
                res = res * newRes % MOD;
            }
            out.println(res);
        }

        private long[] getProbability(int start, int k) {
            long[][] probability = new long[2][start + 1];
            int p = 0;
            probability[p][start] = 1;
            while (k-- > 0) {
                p ^= 1;
                long[] cur = probability[p];
                long[] last = probability[p ^ 1];
                Arrays.fill(cur, 0);
                for (int j = 0; j <= start; j++) {
                    long currentProb = last[j] * inv[j + 1] % MOD;
                    if (currentProb == 0) continue;
                    for (int i = 0; i <= j; i++) {
                        cur[i] += currentProb;
                        cur[i] %= MOD;
                    }
                }
            }
            return probability[p];
        }

        private HashMap<Long, Integer> getAllDivisors(long n) {
            HashMap<Long, Integer> res = new HashMap<>();
            int p = 2;
            n = handle(p, res, n);
            p = 3;
            while (p <= n && p * p <= n) {
                n = handle(p, res, n);
                p += 2;
            }
            if (n != 1) n = handle(n, res, n);
            return res;
        }

        private long handle(long p, HashMap<Long, Integer> res, long n) {
            int count = 0;
            while (n % p == 0) {
                n /= p;
                count++;
            }
            if (count != 0) res.put(p, count);

            return n;
        }

    }

    static class OutputWriter extends PrintWriter {
        public OutputWriter(Writer out) {
            super(out);
        }

        public OutputWriter(File file) throws FileNotFoundException {
            super(file);
        }

        public OutputWriter(OutputStream out) {
            super(out);
        }

    }

    static class MathExtensions {
        public static final long DEFAULT_MOD = 1_000_000_007L;

        public static long modInverse_For_M_Prime(final long a, final long m) {
            return powerMod(a, m - 2, m);
        }

        public static long powerMod(final long x, final long y, final long m) {
            if (y == 0)
                return 1;

            long p = powerMod(x, y / 2, m) % m;
            p = (p * p) % m;

            if (y % 2 == 0)
                return p;
            else
                return (x * p) % m;
        }

    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine(), " \t\n\r\f,");
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int NextInt() {
            return Integer.parseInt(next());
        }

        public long NextLong() {
            return Long.parseLong(next());
        }

    }
}


import java.util.*;
public class D {
    public static final long MOD = 1000000007;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();
        int K = scanner.nextInt();
        int mFact = 2*(int)Math.ceil(Math.sqrt(N));
        long[] inv = new long[mFact];
        for(int i = 0; i < mFact; i++) {
            inv[i] = modInverse(i);
        }
        ArrayDeque<Long> factorQ = new ArrayDeque<>();
        factorQ.add(N);
        int nextNode = 0;
        ArrayList<ArrayList<Long>> factorsList = new ArrayList<>();
        HashMap<Long, Integer> parsed = new HashMap<>();
        parsed.put(N, nextNode++);
        while(!factorQ.isEmpty()) {
            long next = factorQ.poll();
            ArrayList<Long> f = new ArrayList<>();
            for(long i = 1; i*i<=next; i++) {
                if (next%i==0) {
                    f.add(i);
                    if (next/i!=i) f.add(next/i);
                    if (!parsed.containsKey(i)) {
                        parsed.put(i, nextNode++);
                        factorQ.add(i);
                        if (next / i != i && !parsed.containsKey(next / i)) {
                            parsed.put(next / i, nextNode++);
                            factorQ.add(next / i);
                        }
                    }
                }
            }
            factorsList.add(f);
        }
        Set<Long> set = parsed.keySet();
        long[][] dp = new long[K+1][nextNode];
        for( long n: set) {
            dp[0][parsed.get(n)]=((n%MOD)*inv[factorsList.get(0).size()])%MOD;
        }
        for(int i = 1; i < K; i++) {
            for(int n = 0; n < nextNode; n++) {
                for(long ff: factorsList.get(n)) {
                    dp[i][n] = (dp[i][n] + dp[i-1][parsed.get(ff)])%MOD;
                }
                dp[i][n] = (dp[i][n] * inv[factorsList.get(n).size()])%MOD;
            }
        }
        long out = 0;
        for(int i = 0; i < nextNode; i++) {
            out = (out + dp[K-1][i])%MOD;
        }
        System.out.println(out);
    }
//    public static class Prob {
//        long num;
//        long curProb;
//        ArrayList<Long> factors;
//        public Prob (long nn, long cc, ArrayList<Long> ff) {
//            factors = ff;
//            num = nn;
//            curProb = cc;
//        }
//    }
    public static long modInverse(long x)
    {
        return modPow(x, MOD-2);
    }
    public static long modPow(long x, long y) {
        if (y == 0) return 1;
        long p = modPow(x, y / 2) %MOD;
        p = (p * p) % MOD;
        if (y % 2 == 0) return p;
        else return (x * p) % MOD;
    }
}


import java.util.*;
public class D {
    public static final long MOD = 1000000007;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        long N = scanner.nextLong();
        int K = scanner.nextInt();
        ArrayDeque<Long> factorQ = new ArrayDeque<>();
        factorQ.add(N);
        int nextNode = 0;
        ArrayList<ArrayList<Long>> factorsList = new ArrayList<>();
        HashMap<Long, Integer> parsed = new HashMap<>();
        parsed.put(N, nextNode++);
        int maxSize = 0;
        while(!factorQ.isEmpty()) {
            long next = factorQ.poll();
            ArrayList<Long> f = new ArrayList<>();
            for(long i = 1; i*i<=next; i++) {
                if (next%i==0) {
                    f.add(i);
                    if (next/i!=i) f.add(next/i);
                    if (!parsed.containsKey(i)) {
                        parsed.put(i, nextNode++);
                        factorQ.add(i);
                        if (next / i != i && !parsed.containsKey(next / i)) {
                            parsed.put(next / i, nextNode++);
                            factorQ.add(next / i);
                        }
                    }
                }
            }
            maxSize = Math.max(maxSize, f.size());
            factorsList.add(f);
        }
        long[] inv = new long[maxSize+1];
        for(int i = 0; i <= maxSize; i++) {
            inv[i] = modInverse(i);
        }
        Set<Long> set = parsed.keySet();
        long[] dpPrev = new long[nextNode];
        long[] dpNext = new long[nextNode];
        //long[][] dp = new long[K+1][nextNode];
        for( long n: set) {
            dpPrev[parsed.get(n)]=((n%MOD)*inv[factorsList.get(0).size()])%MOD;
        }
        for(int i = 1; i < K; i++) {
            for(int n = 0; n < nextNode; n++) {
                for(long ff: factorsList.get(n)) {
                    dpNext[n] = (dpNext[n] + dpPrev[parsed.get(ff)])%MOD;
                }
                dpNext[n] = (dpNext[n] * inv[factorsList.get(n).size()])%MOD;
            }
            dpPrev = dpNext;
            dpNext = new long[nextNode];
        }
        long out = 0;
        for(int i = 0; i < nextNode; i++) {
            out = (out + dpPrev[i])%MOD;
        }
        System.out.println(out);
    }
    public static long modInverse(long x)
    {
        return modPow(x, MOD-2);
    }
    public static long modPow(long x, long y) {
        if (y == 0) return 1;
        long p = modPow(x, y / 2) %MOD;
        p = (p * p) % MOD;
        if (y % 2 == 0) return p;
        else return (x * p) % MOD;
    }
}


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeSet;
public class DHello2019 {

	public static final long p = 1_000_000_007;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long N = in.nextLong();
		int K = in.nextInt();

		ArrayList<Long> nFactors = getFactors(N);
		int M = nFactors.size();

		long[][] markovA = setMarkovChain(nFactors, M);

		long[][] ApowK = exponentiate(markovA, K);

		long[][] B = new long[M][1];
		for(int i = 0; i < B.length; i++)
			B[i][0] = nFactors.get(i) % p;

		long[][] finalProduct = multiply(ApowK, B);

		long result = finalProduct[M-1][0];
		System.out.println(result);
		in.close();
	}

	public static long[][] exponentiate(long[][] A, int pow) {
		String binary = Integer.toBinaryString(pow);
		long[][][] powers = new long[binary.length()][A.length][A.length];
		powers[powers.length-1] = A;
		for(int i = powers.length-2; i >= 0; i--)
			powers[i] = multiply(powers[i+1], powers[i+1]);

		long[][] product = powers[0];
		for(int i = 1; i < powers.length; i++)
			if(binary.charAt(i) == '1')
				product = multiply(product, powers[i]);

		return product;
	}

	public static long[][] multiply(long[][] A, long[][] B) {
		long[][] C = new long[A.length][B[0].length];
		for(int i = 0; i < A.length; i++)
			for(int j = 0; j < B[0].length; j++)
				for(int k = 0; k < A[0].length; k++)
					C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % p;

		return C;
	}

	public static ArrayList<Long> getFactors(long N) {
		TreeSet<Long> set = new TreeSet<>();
		for(long i = 1; i <= Math.sqrt(N); i++) {
			if(N % i == 0) {
				set.add(i);
				set.add(N/i);
			}
		}

		ArrayList<Long> factors= new ArrayList<>();
		for(long i : set)
			factors.add(i);

		return factors;
	}

	/**
	 * Extended Euclidean algorithm find x such that ax = 1 (mod m)
	 * @param a
	 * @param m
	 * @return modular inverse of a mod m
	 */
	public static long modInverse(long a, long m) {
		long[] a1 = {a, 1, 0};
		long[] b1 = {m, 0, 1};
		while(b1[0] != 0) {
			long[] c1 = new long[3];
			long q = a1[0] / b1[0];
			c1[0] = a1[0] - q * b1[0];
			c1[1] = a1[1] - q * b1[1];
			c1[2] = a1[2] - q * b1[2];
			a1 = b1;
			b1 = c1;
		}

		if(a1[1] < 0) a1[1] += m;
		return a1[1];
	}

	public static long[][] setMarkovChain(ArrayList<Long> nFactors, int M) {
		int index = 0;
		HashMap<Long, Integer> mapIndex = new HashMap<>();
		for(long i : nFactors)
			mapIndex.put(i, index++);

		boolean[][] factors = new boolean[M][M];

		for(int col = 0; col < M; col++) {
			long divisor = nFactors.get(col);
			for(int row = 0; row < M; row++)
				if(nFactors.get(row) % divisor == 0)
					factors[row][col] = true;
		}

		int[] sumRows = new int[M];
		for(int i = 0; i < M; i++)
			for(int j = 0; j < M; j++)
				if(factors[i][j])
					sumRows[i]++;

		long[] inverses = new long[M];
		for(int i = 0; i < M; i++)
			inverses[i] = modInverse(sumRows[i], p);

		long[][] markovA = new long[M][M];
		for(int i = 0; i < M; i++)
			for(int j = 0; j < M; j++)
				if(factors[i][j])
					markovA[i][j] = inverses[i];

		return markovA;
	}

	public static void print(boolean[][] a) {
		for(int i = 0; i < a.length; i++) {
			for(int j = 0; j < a[i].length; j++)
				System.out.print(a[i][j] ? 1 : 0);
			System.out.println();
		}
		System.out.println();
	}

	public static void print(long[][] a) {
		for(int i = 0; i < a.length; i++) {
			for(int j = 0; j < a[i].length; j++)
				System.out.print(a[i][j] + " ");
			System.out.println();
		}
		System.out.println();
	}

}
/*
6 1
outputCopy
3
inputCopy
6 2
outputCopy
875000008
inputCopy
60 5
outputCopy
237178099

1000000000000 100
976589177

100000000 100
141584224

1000000000000000 10000
215514159
*/


import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
import java.util.TreeSet;
public class DHello2019 {

	public static final long p = 1_000_000_007;
	public static int countCall = 0;
	public static long start;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		long N = in.nextLong();
		int K = in.nextInt();

		start = System.currentTimeMillis();

		ArrayList<Long> nFactors = getFactors2(N);
		int M = nFactors.size();

//		System.out.println("M = " + M);
//		System.out.println("Stage 1: " + (System.currentTimeMillis() - start) + " milliseconds");

		long[][] markovA = setMarkovChain(nFactors, M);

//		System.out.println("Stage 2: " + (System.currentTimeMillis() - start) + " milliseconds");

		long[][] B = new long[M][1];
		for(int i = 0; i < B.length; i++)
			B[i][0] = nFactors.get(i) % p;

//		System.out.println("Stage 3: " + (System.currentTimeMillis() - start) + " milliseconds");

		//long[][] ApowK = exponentiate5(markovA, K);
		long[][] ApowK = exponentiate4(markovA, K, B);

//		System.out.println("Stage 4: " + (System.currentTimeMillis() - start) + " milliseconds");

		long[][] finalProduct = multiply(ApowK, B);

//		System.out.println("Stage 5: " + (System.currentTimeMillis() - start) + " milliseconds");

		long result = finalProduct[M-1][0];
//		if(result < 0) result += p;
		System.out.println(result);
//		System.out.println("Took " + (System.currentTimeMillis() - start) + " milliseconds");
		in.close();
	}

	public static long[][] exponentiate(long[][] A, int pow) {
		String binary = Integer.toBinaryString(pow);
		long[][][] powers = new long[binary.length()][A.length][A.length];
		powers[powers.length-1] = A;
		for(int i = powers.length-2; i >= 0; i--)
			powers[i] = multiply(powers[i+1], powers[i+1]);

		long[][] product = powers[0];
		for(int i = 1; i < powers.length; i++)
			if(binary.charAt(i) == '1')
				product = multiply(product, powers[i]);

		return product;
	}

	public static long[][] exponentiate2(long[][] A, int pow) {
		String binary = Integer.toBinaryString(pow);
		long[][][] powers = new long[binary.length()][A.length][A.length];
		powers[powers.length-1] = A;
		for(int i = powers.length-2; i >= 0; i--)
			strassen(powers[i+1], powers[i+1], powers[i]);

		long[][] product = powers[0];
		for(int i = 1; i < powers.length; i++) {
			if(binary.charAt(i) == '1') {
				long[][] temp = new long[A.length][A.length];
				strassen(product, powers[i], temp);
				product = temp;
			}
		}

		return product;
	}

	public static long[][] exponentiate3(long[][] A, int pow, long[][] B) {
		long[][] product = B;
		for(int i = 0; i < pow; i++) {
			product = multiply(A, product);
		}

		return product;
	}

	public static long[][] exponentiate4(long[][] A, int pow, long[][] B) {
		String binary = Integer.toBinaryString(pow);
		long[][][] powers = new long[binary.length()][A.length][A.length];
		powers[powers.length-1] = A;
		for(int i = powers.length-2; i >= 0; i--)
			powers[i] = multiplyLowerTriangular(powers[i+1], powers[i+1]);

		long[][] product = powers[0];
		int stop = 7;
		for(int i = 1; i < Math.min(stop, binary.length()); i++)
			if(binary.charAt(i) == '1')
				product = multiplyLowerTriangular(product, powers[i]);

		int totalDone = 0;
		for(int i = 0; i < Math.min(stop, binary.length()); i++) {
			if(binary.charAt(i) == '1')
				totalDone += (1 << (binary.length()-i-1));
		}

//		System.out.println("HALFWAY: " + (System.currentTimeMillis() - start) + " milliseconds");

		product = multiply(product, B);
		int rest = pow - totalDone;
		for(int i = 0; i < rest; i++)
			product = multiply(A, product);

		return product;
	}

	public static long[][] exponentiate5(long[][] A, int pow) {
		String binary = Integer.toBinaryString(pow);
		long[][][] powers = new long[binary.length()][A.length][A.length];
		powers[powers.length-1] = A;
		for(int i = powers.length-2; i >= 0; i--)
			powers[i] = multiplyLowerTriangular(powers[i+1], powers[i+1]);

		long[][] product = powers[0];
		for(int i = 1; i < powers.length; i++)
			if(binary.charAt(i) == '1')
				product = multiplyLowerTriangular(product, powers[i]);

		return product;
	}

	public static long[][] multiply(long[][] A, long[][] B) {
		countCall++;

		long[][] C = new long[A.length][B[0].length];
		for(int i = 0; i < A.length; i++)
			for(int j = 0; j < B[0].length; j++)
				for(int k = 0; k < A[0].length; k++)
					C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % p;

		return C;
	}

	public static long[][] multiplyLowerTriangular(long[][] A, long[][] B) {
		countCall++;

		long[][] C = new long[A.length][B[0].length];
		for(int i = 0; i < A.length; i++)
			for(int j = 0; j <= i; j++)
				for(int k = 0; k < i-j+1; k++)
					C[i][j] = (C[i][j] + A[i][k+j] * B[k+j][j]) % p;

		return C;
	}

	public static void naiveMultiply(long[][] A, long[][] B, long[][] C) {
		for(int i = 0; i < A.length; i++)
			for(int j = 0; j < B[0].length; j++)
				for(int k = 0; k < A[0].length; k++)
					C[i][j] = (C[i][j] + A[i][k] * B[k][j]) % p;
	}

	public static void strassen(long[][] a1, long[][] b1, long[][] c) {
		int N = a1.length + (((a1.length & 1) == 1) ? 1 : 0);

		if(N <= 10) {
			naiveMultiply(a1, b1, c);
			return;
		}

		long[][] a = new long[N][N];
		long[][] b = new long[N][N];
		for(int i = 0; i < a1.length; i++) {
			for(int j = 0; j < a1[i].length; j++) {
				a[i][j] = a1[i][j];
				b[i][j] = b1[i][j];
			}
		}

		int half = N >> 1;
		long[][][] sums = new long[14][half][half];
		for(int i = 0; i < half; i++) {
			for(int j = 0; j < half; j++) {
				sums[0][i][j] = (a[i][j] + a[i+half][j+half]) % p;		//a11 + a22
				sums[1][i][j] = (b[i][j] + b[i+half][j+half]) % p;		//b11 + b22
				sums[2][i][j] = (a[i+half][j] + a[i+half][j+half]) % p;	//a21 + a22
				sums[3][i][j] = (b[i][j+half] - b[i+half][j+half]) % p;	//b12 - b22
				sums[4][i][j] = (b[i+half][j] - b[i][j]) % p;				//b21 - b11
				sums[5][i][j] = (a[i][j] + a[i][j+half]) % p;				//a11 + a12
				sums[6][i][j] = (a[i+half][j] - a[i][j]) % p;				//a21 - a11
				sums[7][i][j] = (b[i][j] + b[i][j+half]) % p;				//b11 + b12
				sums[8][i][j] = (a[i][j+half] - a[i+half][j+half]) % p;	//a12 - a22
				sums[9][i][j] = (b[i+half][j] + b[i+half][j+half]) % p;	//b21 + b22
				sums[10][i][j] = a[i][j];							//a11
				sums[11][i][j] = a[i+half][j+half];					//a22
				sums[12][i][j] = b[i][j];							//b11
				sums[13][i][j] = b[i+half][j+half];					//b22
			}
		}

		long[][][] Ms = new long[7][half][half];

		strassen(sums[0], sums[1], Ms[0]);
		strassen(sums[2], sums[12], Ms[1]);
		strassen(sums[10], sums[3], Ms[2]);
		strassen(sums[11], sums[4], Ms[3]);
		strassen(sums[5], sums[13], Ms[4]);
		strassen(sums[6], sums[7], Ms[5]);
		strassen(sums[8], sums[9], Ms[6]);

		for(int i = 0; i < half; i++)
			for(int j = 0; j < half; j++)
				c[i][j] = (Ms[0][i][j] + Ms[3][i][j] - Ms[4][i][j] + Ms[6][i][j]) % p;

		for(int i = 0; i < half; i++)
			for(int j = 0; j+half < c[i].length; j++)
				c[i][j+half] = (Ms[2][i][j] + Ms[4][i][j]) % p;

		for(int i = 0; i+half < c.length; i++)
			for(int j = 0; j < half; j++)
				c[i+half][j] = (Ms[1][i][j] + Ms[3][i][j]) % p;

		for(int i = 0; i+half < c.length; i++)
			for(int j = 0; j+half < c[i].length; j++)
				c[i+half][j+half] = (Ms[0][i][j] - Ms[1][i][j] + Ms[2][i][j] + Ms[5][i][j]) % p;

	}

	public static ArrayList<Long> getFactors2(long N) {
		TreeSet<Long> set = new TreeSet<>();
		long n = N;
		if(n % 2 == 0) {
			set.add(2L);
			while(n % 2 == 0) {
				n >>= 1;
			}
		}

		for(long i = 3; i <= Math.sqrt(n) && n > 1; i += 2) {
			if(n % i == 0) {
				set.add(i);
				while(n % i == 0)
					n /= i;
			}
		}

		if(n > 1)
			set.add(n);

		ArrayList<Long> primes = new ArrayList<>();
		for(long i : set)
			primes.add(i);

		ArrayList<ArrayList<Long>> listFactors = new ArrayList<>();
		for(int i = 0; i < set.size(); i++)
			listFactors.add(new ArrayList<Long>());

		for(int i = 0; i < listFactors.size(); i++) {
			ArrayList<Long> temp = listFactors.get(i);
			long p = primes.get(i);
			long curr = 1;
			while(N % curr == 0) {
				temp.add(curr);
				curr *= p;
			}
		}

		ArrayList<Long> factors = new ArrayList<Long>();
		recurse(factors, listFactors, 1, 0);
		Collections.sort(factors);

		return factors;
	}

	public static void recurse(ArrayList<Long> factors, ArrayList<ArrayList<Long>> listFactors, long curr, int index) {
		if(index == listFactors.size()) {
			factors.add(curr);
			return;
		}

		ArrayList<Long> temp = listFactors.get(index);
		for(long i : temp) {
			recurse(factors, listFactors, curr * i, index + 1);
		}
	}

	public static ArrayList<Long> getFactors(long N) {
		TreeSet<Long> set = new TreeSet<>();
		for(long i = 1; i <= Math.sqrt(N); i++) {
			if(N % i == 0) {
				set.add(i);
				set.add(N/i);
			}
		}

		ArrayList<Long> factors= new ArrayList<>();
		for(long i : set)
			factors.add(i);

		return factors;
	}

	/**
	 * Extended Euclidean algorithm find x such that ax = 1 (mod m)
	 * @param a
	 * @param m
	 * @return modular inverse of a mod m
	 */
	public static long modInverse(long a, long m) {
		long[] a1 = {a, 1, 0};
		long[] b1 = {m, 0, 1};
		while(b1[0] != 0) {
			long[] c1 = new long[3];
			long q = a1[0] / b1[0];
			c1[0] = a1[0] - q * b1[0];
			c1[1] = a1[1] - q * b1[1];
			c1[2] = a1[2] - q * b1[2];
			a1 = b1;
			b1 = c1;
		}

		if(a1[1] < 0) a1[1] += m;
		return a1[1];
	}

	public static long[][] setMarkovChain(ArrayList<Long> nFactors, int M) {
		int index = 0;
		HashMap<Long, Integer> mapIndex = new HashMap<>();
		for(long i : nFactors)
			mapIndex.put(i, index++);

		boolean[][] factors = new boolean[M][M];

		for(int col = 0; col < M; col++) {
			long divisor = nFactors.get(col);
			for(int row = 0; row < M; row++)
				if(nFactors.get(row) % divisor == 0)
					factors[row][col] = true;
		}

		int[] sumRows = new int[M];
		for(int i = 0; i < M; i++)
			for(int j = 0; j < M; j++)
				if(factors[i][j])
					sumRows[i]++;

		long[] inverses = new long[M];
		for(int i = 0; i < M; i++)
			inverses[i] = modInverse(sumRows[i], p);

		long[][] markovA = new long[M][M];
		for(int i = 0; i < M; i++)
			for(int j = 0; j < M; j++)
				if(factors[i][j])
					markovA[i][j] = inverses[i];

		return markovA;
	}

	public static void print(boolean[][] a) {
		for(int i = 0; i < a.length; i++) {
			for(int j = 0; j < a[i].length; j++)
				System.out.print(a[i][j] ? 1 : 0);
			System.out.println();
		}
		System.out.println();
	}

	public static void print(long[][] a) {
		for(int i = 0; i < a.length; i++) {
			for(int j = 0; j < a[i].length; j++)
				System.out.print(a[i][j] + " ");
			System.out.println();
		}
		System.out.println();
	}

}
/*
6 1
outputCopy
3
inputCopy
6 2
outputCopy
875000008
inputCopy
60 5
outputCopy
237178099

1000000000000 100
976589177

100000000 100
141584224

1000000000000000 10000
215514159
*/


import java.util.*;
import java.io.*;
import java.lang.*;
import java.math.*;
public class D {
    public static int mod = 1000000007;
    public static void main(String[] args) throws Exception {
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
        // Scanner scan = new Scanner(System.in);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        // int n = Integer.parseInt(bf.readLine());
        StringTokenizer st = new StringTokenizer(bf.readLine());
        // int[] a = new int[n]; for(int i=0; i<n; i++) a[i] = Integer.parseInt(st.nextToken());
        long n = Long.parseLong(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        Map<Long, Integer> factorization = new HashMap<Long, Integer>();
        if(n % 2 == 0) {
          int count = 0;
          while(n % 2 == 0) {
            n /= 2;
            count++;
          }
          factorization.put(2L, count);
        }
        for(int i=3; i*i<=n; i+=2) {
          if(n % i == 0) {
            int count = 0;
            while(n % i == 0) {
              n /= i;
              count++;
            }
            factorization.put(i+0L, count);
          }
        }
        if(n > 1) {
          factorization.put(n+0L, 1);
        }

        long ans = 1;

        for(long p : factorization.keySet()) {
          int exp = factorization.get(p);
        //  out.println(p + " " + exp);
          long[][] dp = new long[exp+1][k+1];
          dp[0][0] = 1L;
          for(int i=1; i<=exp; i++) dp[i][0] = (dp[i-1][0] * p) % mod;
          for(int j=0; j<=k; j++) dp[0][j] = 1L;
          for(int i=1; i<=exp; i++) {
            for(int j=1; j<=k; j++) {
              dp[i][j] = 1L*inv(i+1) * ((dp[i][j-1] + 1L*i*dp[i-1][j]) % mod) % mod;
            }
          }
        //  out.println(dp[exp][k]);

          ans = (ans * dp[exp][k]) % mod;
        }

        out.println((ans % mod));

        // int n = scan.nextInt();

        out.close(); System.exit(0);
    }

    // Exponentation
    public static int exp(int base, int e) {
      if(e == 0) return 1;
      if(e == 1) return base;
      int val = exp(base, e/2);
      int ans = (int)(1L*val*val % mod);
      if(e % 2 == 1)
        ans = (int)(1L*ans*base % mod);
      return ans;
    }

    // Exponentation
    public static int inv(int base) {
      return exp(base, mod-2);
    }
}


import java.io.*;
import java.util.*;
import java.math.BigInteger;
public class Hello2019D {

	BufferedReader in;
	StringTokenizer st;
	PrintWriter ob;

	long mod = (long)1e9+7;

	public static void main( String args[] ) throws IOException {
		new Hello2019D().run();
	}
	void run() throws IOException {
		in = new BufferedReader ( new InputStreamReader( System.in ) );
		ob = new PrintWriter( System.out );
		solve();
		ob.flush();
	}
	void solve() throws IOException {
		long n = nl();
		int k = ni();

		long result = 1;
		for(int prime = 2 ; prime*prime<=n ; prime++) {

			int power = 0 ;
			while( n%prime == 0 ) {
				power++;
				n/=prime;
			}

			if( power > 0  ) {
				result = result * solvePrime( (long)prime , power , k  );
				result = result % mod;
			}
		}

		if( n>1 ) {
			result *= solvePrime( n , 1 , k  );
			result %= mod;
		}

		ob.println( result );
	}

	long solvePrime( long prime , int power , int k )
	{
		if( k==1 ) {
			long numerator = (long)Math.pow( prime , power + 1 ) - 1;
			long denominator = prime - 1;
			numerator /= denominator;

			return (( numerator * inverse( power+1 ) )%mod);
		}

		long expectation = 1 ;
		for( int i=1 ; i<=power ; i++ ) {
			expectation +=  solvePrime( prime , i , k-1 );
			expectation %= mod;
		}
		return ((expectation * inverse( power+1 )) % mod);
	}

	long inverse( long n ) {
		return (new BigInteger(""+n).modInverse( new BigInteger(""+mod))).longValue();
	}

	long nl() throws IOException {
		return Long.parseLong( nextToken() );
	}
	int ni() throws IOException {
		return Integer.parseInt( nextToken() );
	}
	String nextToken() throws IOException {
		if( st == null || !st.hasMoreTokens() )
			st = new StringTokenizer( in.readLine() );
		return st.nextToken();
	}
}


import java.lang.reflect.Array;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class D {
    static long mod = 1000000007;
    static long pow(long a, long b) {
        if (b == 0) {
            return 1;
        }
        if (b % 2 == 0) {
            return pow(a * a % mod, b / 2);
        } else {
            return pow(a * a % mod, b / 2) % mod * a % mod;
        }
    }

    static long res = 0;
    static long work(long[] f, int[] f2, long[][] ans, int idx, int c, long num, long pro) {
        if (c == idx) {
//            System.out.println("final " + num + " " + pro);
            res += num * pro;
            res %= mod;

            return 0;
        }

        long sum = 0;

        for (int i = 0; i <= f2[c]; i++) {
            long[] ans_ = new long[2];
            ans_[0] =

            work(f, f2, ans, idx, c + 1, num * pow(f[c], i) % mod, pro * ans[c][i] % mod);

            //sum += ans_ [0] * ans_ [1];
            //sum %= mod;

        }

        return 0;
    }

    public static void main(String[] aaaa) {
        Scanner scanner = new Scanner(System.in);

        long n = scanner.nextLong();
        int k = scanner.nextInt();

        long[] f = new long[100];
        int[] f2 = new int[100];
        long[][] dp = new long[10005][105];
        long[][] ans = new long[105][105];
        int idx = 0;

        long nn = n;
        for (long i = 2; i * i < n; i++) {
            if (nn == 1) {
                break;
            }
            if (nn % i == 0) {
                //System.out.println(i);
                f[idx] = i;
                while (nn % i == 0) {
                    nn /= i;
                    f2[idx]++;
                }

                idx++;

            }
        }
        if (nn > 1) {
            f[idx] = nn;
            f2[idx]++;
            idx++;
        }
//        for (int i = 0; i < idx; i++) {
//            System.out.println(f[i] + " " + f2[i]);
//        }

        for (int i = 0; i < idx; i++) {
            Arrays.fill(dp[0], 0);
            dp[0][f2[i]] = 1;
            for (int j = 1; j <= k; j++) {
//                long sum = 0;
                for (int l = f2[i]; l >= 0; l--) {

//
//                    sum += dp[j - 1][l];
//                    sum %= mod;
                    long sum = 0;
                    for (int m = f2[i]; m >= l; m--) {
                        sum += (dp[j - 1][m] * pow(m + 1, mod - 2));
                        sum %= mod;
                    }

                    dp[j][l] = sum;

//                    System.out.println(j + " " + l + " " + dp[j][l]);
                }
            }

            for (int j = 0; j <= f2[i]; j++) {
                ans[i][j] = dp[k][j];
            }

        }

        work(f, f2, ans, idx, 0, 1, 1);
        System.out.println(res);

    }
}


import java.util.*;
import java.io.*;

public class MakotoAndBlackboard {
    public static long MOD = 1000000007;
    public static void main(String[] args) throws IOException {
        BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        StringTokenizer st = new StringTokenizer(f.readLine());
        long n = Long.parseLong(st.nextToken());
        int k = Integer.parseInt(st.nextToken());
        ArrayList<Long> primes = getFacs(n);
        long ans = 1;
        for (int q = 0; q < primes.size(); q += 2) {
            long tnn = primes.get(q);
            int ct = primes.get(q + 1).intValue();
            long[][] dp = new long[k + 1][ct + 1];
            dp[0][ct] = 1L;
            for (int i = 0; i < k; i++) {
                for (int j = ct; j >= 0; j--) {
                    for(int jj = j; jj >= 0; jj--){
                        dp[i+1][jj] += (dp[i][j]*modInverse(j+1, MOD)) % MOD;
                        dp[i+1][jj] %= MOD;
                    }
                }
            }
            long val = 1;
            long expval = 0;
            for(int j = 0; j <= ct; j++){
                expval += (val*dp[k][j]) % MOD;
                expval %= MOD;
                val*=tnn;
                val%=MOD;
            }
            ans*=expval;
            ans%=MOD;
        }
        out.println(ans);
        out.close();

    }
    public static ArrayList<Long> getFacs(long n){
        ArrayList<Long> facs = new ArrayList<Long>();
        int ctt = 0;
        while(n % 2 == 0){
            n/=2;
            ctt++;
        }
        facs.add(2L);
        facs.add((long)ctt);
        for(long i = 3; i <= Math.sqrt(n)+0.000001; i+=2){
            if(n % i == 0){
                int ct = 0;
                while(n % i == 0){
                    n/=i;
                    ct++;
                }
                facs.add(i);
                facs.add((long)ct);
            }
        }
        if(n > 2){
            facs.add(n);
            facs.add(1L);
        }
        return facs;
    }

    public static long modInverse(long a, long m)
    {
        return power(a, m-2, m);
    }

    // To compute x^y under modulo m

    public static long power(long x, long y, long p)
    {
        // Initialize result
        long res = 1;

        // Update x if it is more
        // than or equal to p
        x = x % p;

        if (x == 0L) return 0L; // In case x is divisible by p;

        while (y > 0)
        {
            // If y is odd, multiply x
            // with result
            if((y & 1)==1)
                res = (res * x) % p;

            // y must be even now
            // y = y / 2
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }
}


import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scnaner.nextInt();
        int amount = 0;
        if (m * a >= b) {
            amount = ((n / m) * b) + ((n % m) * a);
        } else {
            amount = n * a;
        }

        System.out.print(amount);
    }
}


import java.util.*;

public class Main
{

    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        double a = sc.nextInt();
        double b = sc.nextInt();
        if(a<=(b/m))
            System.out.print((int)(n*a));
        else
            System.out.print((int)((n/m)*b + (n%m * a));
    }
}


import java.util.*;
import java.lang.*;
import java.io.*;
public class VasyaAndSocks
{
    public static void main(String args[])
    {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int a=sc.nextInt();
        int b=sc.nextInt();
        int min=100000000;
        int maxM=n/m;
        for (int i=0; i<=maxM+1; i++)
        {
            if (i=maxM+1)
            {
                int c=(i*b);
            }
            else
            {
                int c=(i*b)+((n-(m*i))*a);
            }
            if (c<min)
            {
                min=c;
            }
        }
        System.out.println(min);
    }
}


import java.io.*;
import java.util.*;
public class flip
{
	static int no=0;
	public static void main(String args[])throws IOException
	{
		int arr[],n,m;
		BufferedReader k=new BufferedReader(new InputStreamReader(System.in));
		n=Integer.parseInt(k.readLine());
		String nm=k.readLine();
		nm=nm.replace(" ","");
		func(nm,0,nm.length());
		System.out.println(no);
	}
	public static void func(String nm,int a,int b)
	{
		if(a<b)
		{
			String pm="";int count=0;
			for(int i=0;i<nm.length();i++)
			{
				if(i<a || i>b)
				pm=pm+nm.charAt(i);
				else
				{
					if(nm.charAt(i)=='0')
					pm=pm+"1";
					else
					pm=pm+"0";
				}
				if(pm.charAt(i)=='1')
				count++;
			}
			if(no<count)
				no=count;
			func(nm,a+1,b);
			func(nm,a,b-1);
		}
	}
}


import java.util.*;
public class FindtheBug{
	   public static void main(String[] args) {
	        // Use the Scanner class
	        Scanner in = new Scanner(System.in);
	        int digits = in.nextInt();
	        int nums[] = new int[digits];
	        String val = in.next();
	        ArrayList<Integer> rets = new ArrayList<Integer>();
	        for(int i = 0; i < digits; i++){
	        	nums[i] = Integer.parseInt(""+val.charAt(i));
	        	if(nums[i] == 0)
	        		continue;
	        	else if(nums[i] == 2){
	        		rets.add(2);
	        	}
	        	else if(nums[i] == 3){
	        		rets.add(3);
	        	}
	        	else if(nums[i] == 4){
	        		rets.add(3);
	        		rets.add(2);
	        		rets.add(2);
	        	}
	        	else if(nums[i] == 5){
	        		rets.add(5);
	        	}
	        	else if(nums[i] == 6){
	        		rets.add(5);
	        		rets.add(3);
	        	}
	        	else if(nums[i] == 7){
	        		rets.add(7);
	        	}
	        	else if(nums[i] == 8){
	        		rets.add(7);
	        		rets.add(2);
	        		rets.add(2);
	        		rets.add(2);
	        	}
	        	else if(nums[i] == 9){
	        		rets.add(7);
	        		rets.add(3);
	        		rets.add(3);
	        		rets.add(2);
	        	}
	        }
	        Collections.sort(rets);
        	for(int x = rets.size() - 1; x >= 0; x--)
        		System.out.print(rets.get(x));

	      /*
	      int n      = sc.nextInt();        // read input as integer
	      long k     = sc.nextLong();       // read input as long
	      double d   = sc.nextDouble();     // read input as double
	      String str = sc.next();           // read input as String
	      String s   = sc.nextLine();       // read whole line as String
	      */
	    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;
public class F {
static int mod;
public static int sumOfSubsequence(int []a,int msk)
{
	int max=1<<a.length;
	int sum=0;
	for(int i=0;i<max;i++)
	{
		if((msk&1<<i)!=0)
			sum+=a[i];
		sum%=mod;
	}
	return sum;
}
public static int upperbound(int k,int []a)
{
	int ans=-1;int lo=0;int hi=a.length-1;
	while(lo<=hi)
	{
		int mid=(lo+hi)/2;
		if(a[mid]>k)
			hi=mid-1;
		else
		{
			ans=a[mid];
			lo=mid+1;
		}
	}
	return ans;
}
	public static void main(String[] args) throws IOException {
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int n1=n/2;int n2=n-n1;
		mod=sc.nextInt();
		int []a1=new int[n1];int []a2=new int [n2];
		for(int i=0;i<n1;i++)
			a1[i]=sc.nextInt()%mod;
		for(int i=0;i<n2;i++)
			a2[i]=sc.nextInt()%mod;
		n1=1<<n1;n2=1<<n2;
		int []s1=new int [n1];int []s2=new int [n2];
		for(int msk=0;msk<n2;msk++)
		{
			if(msk<n1)
				s1[msk]=sumOfSubsequence(a1,msk);
			s2[msk]=sumOfSubsequence(a2,msk);

		}
		Arrays.sort(s2);
		int max=0;
		for(int i=0;i<n1;i++)
		{
			max=Math.max(max, s1[i]+upperbound(mod-s1[i]-1,s2));
		}
		max=Math.max(max, s2[n2-1]);
		System.out.println(max);

	}

}
class Scanner
{
	StringTokenizer st;
	BufferedReader br;

	public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

	public String next() throws IOException
	{
		while (st == null || !st.hasMoreTokens())
			st = new StringTokenizer(br.readLine());
		return st.nextToken();
	}

	public int nextInt() throws IOException {return Integer.parseInt(next());}

	public long nextLong() throws IOException {return Long.parseLong(next());}

	public String nextLine() throws IOException {return br.readLine();}

	public double nextDouble() throws IOException
	{
		String x = next();
		StringBuilder sb = new StringBuilder("0");
		double res = 0, f = 1;
		boolean dec = false, neg = false;
		int start = 0;
		if(x.charAt(0) == '-')
		{
			neg = true;
			start++;
		}
		for(int i = start; i < x.length(); i++)
			if(x.charAt(i) == '.')
			{
				res = Long.parseLong(sb.toString());
				sb = new StringBuilder("0");
				dec = true;
			}
			else
			{
				sb.append(x.charAt(i));
				if(dec)
					f *= 10;
			}
		res += Long.parseLong(sb.toString()) / f;
		return res * (neg?-1:1);
	}

	public boolean ready() throws IOException {return br.ready();}

}


import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.lang.Math;
import java.math.BigInteger;

public class Problem {

	void solve() throws IOException {

		int n = rI();
		int m = rI();
		ArrayList<Long> a = new ArrayList<>();
		long sum = 0;

		for (int i = 0; i < n; ++i) {
			a.add(rL());
			sum = (sum + a.get(i)) % m;
			;
		}
		long ans = 0;

		for(int j=0;j<7;++j){
			Collections.shuffle(a);

			for (int i = 1; i <= (int) Math.pow(2, Math.min(18, n)); ++i) {
				long curAns = 0;
				for (int bit = 0; bit < Math.min(18, n); ++bit) {
					if (checkBit(i, bit) == 1) {
						curAns = (curAns + a.get(bit)) % m;
					}
				}
				ans = Math.max(curAns, ans);
			}
			Collections.shuffle(a);
			for (int i = 1; i <= (int) Math.pow(2, Math.min(18, n)); ++i) {
				long curAns = sum;
				for (int bit = 0; bit < Math.min(20, n); ++bit) {
					if (checkBit(i, bit) == 1) {
						curAns = (curAns - a.get(bit) % m + m) % m;
					}
				}
				ans = Math.max(curAns, ans);
			}
		}

		out.println(ans);
	}

	class SegmentTree {
		int[] t;

		SegmentTree(int[] a, int n) {
			t = new int[4 * n];
			build(a, 1, 1, n);
		}

		void build(int[] a, int v, int tl, int tr) {
			if (tl == tr) {
				t[v] = a[tl];
				return;
			}

			int tm = (tl + tr) / 2;
			build(a, 2 * v, tl, tm);
			build(a, 2 * v + 1, tm + 1, tr);
			t[v] = Math.min(t[2 * v], t[2 * v + 1]);
		}

		void update(int v, int tl, int tr, int pos, int value) {
			if (tl == tr) {
				t[v] = value;
				return;
			}
			int tm = (tl + tr) / 2;
			if (pos <= tm) {
				update(2 * v, tl, tm, pos, value);
			} else {
				update(2 * v + 1, tm + 1, tr, pos, value);
			}

			t[v] = Math.min(t[2 * v], t[2 * v + 1]);
		}

		int getMin(int v, int tl, int tr, int l, int r) {
			if (l > r) {
				return INF;
			}
			if (tl == l && tr == r) {
				return t[v];
			}

			int tm = (tl + tr) / 2;

			int min1 = getMin(2 * v, tl, tm, l, Math.min(tm, r));
			int min2 = getMin(2 * v + 1, tm + 1, tr, Math.max(l, tm + 1), r);

			return Math.min(min1, min2);
		}
	}

	int checkBit(int mask, int bit) {
		return (mask >> bit) & 1;
	}

	public static void main(String[] args) throws IOException {

		new Problem().run();
	}

	boolean isLower(char a) {
		return ((int) a) >= 97 ? true : false;
	}

	int INF = Integer.MAX_VALUE - 12345;

	int[][] STEPS = { { 0, 1 }, { 1, 0 }, { -1, 0 }, { 0, -1 } };

	BufferedReader in;
	PrintWriter out;
	StringTokenizer tok;
	Random rnd = new Random();
	static final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;

	Problem() throws FileNotFoundException {

		try {
			in = new BufferedReader(new FileReader("input.txt"));
			out = new PrintWriter("output.txt");
		} catch (Exception e) {
			in = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		}

		tok = new StringTokenizer("");
	}

	long checkBit(long mask, int bit) {
		return (mask >> bit) & 1;
	}

	// ======================================================

	// ======================================================
	void run() throws IOException {
		solve();
		out.close();
	}

	char[] reverseCharArray(char[] arr) {
		char[] ans = new char[arr.length];
		for (int i = 0; i < arr.length; ++i) {
			ans[i] = arr[arr.length - i - 1];
		}
		return ans;
	}

	int sqrt(double m) {
		int l = 0;
		int r = 1000000000 + 9;
		int i = 1000;
		while (r - l > 1) {
			int mid = (r + l) / 2;
			if (mid * mid > m) {
				r = mid;
			} else {
				l = mid;
			}
		}
		return l;
	}

	int countPow(int m, int n) {
		int ans = 0;
		while (m % n == 0 && m > 0) {
			ans++;
			m /= n;
		}
		return ans;
	}

	long binPow(long a, long b) {
		if (b == 0) {
			return 1;
		}
		if (b % 2 == 1) {
			return a * binPow(a, b - 1);
		} else {
			long c = binPow(a, b / 2);
			return c * c;
		}

	}

	int gcd(int a, int b) {
		return b == 0 ? a : gcd(b, a % b);
	}

	long pow(long x, long k) {
		long ans = 1;
		for (int i = 0; i < k; ++i) {
			ans *= x;
		}
		return ans;
	}

	class Fenwik {
		private long[] t;
		private int length;

		Fenwik(int[] a) {
			this.length = a.length + 100;
			this.t = new long[length];
			for (int i = 0; i < a.length; ++i) {
				this.inc(i, a[i]);
			}
		}

		void inc(int i, int delta) {
			for (; i < this.length; i = i | (i + 1)) {
				this.t[i] += delta;
			}
		}

		long getSum(int r) {
			long sum = 0;

			for (; r >= 0; r = (r & (r + 1)) - 1) {
				sum += this.t[r];
			}

			return sum;
		}
	}

	// ////////////////////////////////////////////////////////////////////

	String delimiter = " ";

	String readLine() throws IOException {
		return in.readLine();
	}

	String rS() throws IOException {
		while (!tok.hasMoreTokens()) {
			String nextLine = readLine();
			if (null == nextLine)
				return null;

			tok = new StringTokenizer(nextLine);
		}

		return tok.nextToken(delimiter);
	}

	int rI() throws IOException {
		return Integer.parseInt(rS());
	}

	long rL() throws IOException {
		return Long.parseLong(rS());
	}

	double rD() throws IOException {
		return Double.parseDouble(rS());
	}

	int[] rA(int b) {
		int a[] = new int[b];
		for (int i = 0; i < b; i++) {
			try {
				a[i] = rI();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return a;
	}

	int[] readSortedIntArray(int size) throws IOException {
		Integer[] array = new Integer[size];

		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}

	int[] sortedIntArray(int size, int[] array) throws IOException {
		for (int index = 0; index < size; ++index) {
			array[index] = rI();
		}
		Arrays.sort(array);

		int[] sortedArray = new int[size];
		for (int index = 0; index < size; ++index) {
			sortedArray[index] = array[index];
		}

		return sortedArray;
	}
}


import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;

public class MaxSubSeq {
public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	int n = s.nextInt();
	int m = s.nextInt();
	int[] a = new int[n];
	for (int i = 0; i < a.length; i++) {
		a[i] = s.nextInt();
	}
	s.close();
	Set<Integer> obtained = new HashSet<>();
	obtained.add(0);
	for (int i = 0; i<n; i++) {
		Integer[] copy = obtained.toArray(new Integer[0]);
		for(int j:copy) {
			obtained.add((j+a[i])%m);
		}
	}
	int max = 0;
	Iterator<Integer> it = obtained.iterator();
	while(it.hasNext()) {
		max = Math.max(it.next(), max);
	}
	System.out.println(max);

}
}


//package Round;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Scanner;

public class E {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();

        HashSet<Integer> set = new HashSet<>((int) (n / 0.75 + 2));

        for (int i = 0; i < n; i++) {
            int e = scanner.nextInt() % m;

            ArrayList<Integer> a = new ArrayList<>(set.size());
            Iterator<Integer> iterator = set.iterator();

            while (iterator.hasNext()) {
                a.add((iterator.next() + e) % m);
            }

            set.addAll(a);
            set.add(e);
        }

        int max_value = Integer.MIN_VALUE;
        Iterator<Integer> iterator = set.iterator();

        while (iterator.hasNext()) {
            max_value = max(iterator.next(), max_value);
        }

        System.out.println(max_value);
    }

    private static int max(int a, int b) {
        return (a > b) ? a : b;
    }
}


import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;
import java.util.TreeMap;

import static java.lang.Math.*;
import static java.util.Arrays.copyOf;
import static java.util.Arrays.fill;
import static java.util.Arrays.sort;
import static java.util.Collections.reverse;
import static java.util.Collections.reverseOrder;
import static java.util.Collections.sort;

public class Main {
    private FastScanner in;
    private PrintWriter out;

    private void solve() throws IOException {
        long n = in.nextLong(), m = in.nextLong();
        long[] a = new long[(int) n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextLong();
        }
        long ans = 0, sum, k = (long) 1 << n;
        int j;
        for (long i = 1, c; i < k; i++) {
            sum = 0;
            for (j = 0, c = i; j < n; j++, c /= 2) {
                if (c % 2 == 1)
                    sum += a[j];
            }
            ans = max(ans, sum % m);
        }
        out.println(ans);
    }

    private void solveA() throws IOException {

    }

    private void solveB() throws IOException {

    }

    private void solveC() throws IOException {

    }

    private void solveD() throws IOException {

    }

    private void solveE() throws IOException {

    }

    class FastScanner {
        StringTokenizer st;
        BufferedReader br;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        boolean hasNext() throws IOException {
            return br.ready() || (st != null && st.hasMoreTokens());
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }

        double nextDouble() throws IOException {
            return Double.parseDouble(next());
        }

        String nextLine() throws IOException {
            return br.readLine();
        }

        boolean hasNextLine() throws IOException {
            return br.ready();
        }
    }

    private void run() throws IOException {
        in = new FastScanner(System.in); // new FastScanner(new FileInputStream(".in"));
        out = new PrintWriter(System.out); // new PrintWriter(new FileOutputStream(".out"));

        solve();

        out.flush();
        out.close();
    }

    public static void main(String[] args) throws IOException {
        new Main().run();
    }
}


import java.util.Arrays;
import java.util.Scanner;

public class SaveLuke {

	public static void main(String[] args) {

	Scanner sc = new Scanner(System.in);
	int n = sc.nextInt();
	int [] a = new int[n];
	boolean occ [] = new boolean[(int)1e9  + 1];
	for (int i = 0; i < n; i++) {
		a[i] = sc.nextInt();
	}
	Arrays.sort(a);
	long sum = 0;
	for (int i = 0; i < n; i++) {
		if(!occ[a[i]])
		sum += a[i];
		else
		{
			a[i]--;
			sum+= a[i];
		}
		occ[a[i]] = true;
	}
	System.out.println(sum);

}
}


import java.util.*;
public class Practice {
            public static void main(String args[])
            {
                Scanner in = new Scanner(System.in);
                int N = in.nextInt();
                String s = in.next();

                int countSF = 0;
                int countFS = 0;
                for (int i = 0; i < s.length() - 1; i++)
                {
                    if (s.charAt(i) == 'S' && s.charAt(i + 1) == 'F')
                    {
                        countSF++;
                    }
                    if (s.charAt(i) == 'S' && s.charAt(i - 1) == 'S')
                    {
                        countFS++;
                    }
                }
                if (countSF > countFS)
                {
                    System.out.println("YES");
                } else
                {
                    System.out.println("NO");
                }
            }
        }


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

public class CF515C {

	static long[] memo;
	static int[] candidates = new int[]{2,3,4,5,6,7,8,9};
	static BigInteger fNum, max = BigInteger.ZERO;
	public static void main(String[] args) throws Exception {
		memo = new long[10];
		memo[0]=1;
		memo[1]=1;
		for(int i=2;i<memo.length;++i)
			memo[i]=i*memo[i-1];

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		for(String ln;(ln=in.readLine())!=null;){
			int n = Integer.parseInt(ln);
			String number = in.readLine();
			BigInteger big = new BigInteger(number);
			fNum = f(number);

			Queue<String> c = new LinkedList<String>();
			for(int i=0;i<candidates.length;++i){
				c.add(""+candidates[i]);
			}
			String res = number;
			boolean encontre = false;
			while(!encontre && !c.isEmpty()){
				String actual = c.poll();
				BigInteger bigActual = new BigInteger(actual);
				BigInteger valuF = f(actual);
//				System.out.println("actual " +actual + " value " + valuF  + " fNum " + fNum + "  compare ");
				if(valuF.equals(fNum) && bigActual.compareTo(big)>0){
					res = actual;
					encontre=true;
				}else{
					if(valuF.compareTo(fNum)<0){
						for(int i=0;i<candidates.length;++i){
							c.add(actual+""+candidates[i]);
						}
					}
				}
			}

			Integer[] list = new Integer[res.length()];
			for(int i=0;i<list.length;++i){
				list[i]= res.charAt(i)-'0';
			}

			Arrays.sort(list, new Comparator<Integer>() {
				public int compare(Integer o1, Integer o2) {
					return o2.intValue()-o1.intValue();
				}
			});

			for(int i=0;i<list.length;++i)
				System.out.print(list[i]);
			System.out.println();

		}

	}

	static BigInteger f(List<Integer> list){
		String x = "";
		for(int xx: list){
			x= x+xx;
		}
		return f(x);
	}

	static BigInteger f(String n ){
		BigInteger x = BigInteger.ONE;
		for(int i=0;i<n.length();++i){
			x = x.multiply(BigInteger.valueOf(memo[n.charAt(i)-'0']));
		}
		return x;
	}

}


import java.util.*;
import java.lang.Math;
public class In {
    public static void main(String[] args) {Scanner sc = new Scanner(System.in);
        // int[] x={2,4,6};
        long x=sc.nextLong();
        codeforcesA1(x);
        sc.close();}
        private static void codeforcesA1(long r) {
            for (long i = 1; i < Math.pow(10, 12)&&i<r; i++) {
                double variable=r-1-i-(i*i);
                variable=variable/(2*i);
               if (Math.abs(variable - (long) variable) < 0.00000001){
                   System.out.println(i+" "+(long)variable);
                   return;
               }
            }
            System.out.println("NO");
        }

    //static int[] v = new int[6 + 1];
        static public int solve(int A, ArrayList<Integer> B) {

            for (int i = 0; i < B.size(); i++) {
                v[B.get(i).intValue()]=1;
            }
            int as=0;
            Collections.sort(B);
            int ans = 0;
            for (int i = 0; i < B.size(); i++) {
                if(!(i+1<B.size()))
                continue;
                if(i<A-1&&B.get(i+1)==1+i)
                continue;
                B.add(i+1);
                v[B.get(i)] = 1;
                ans+=solve(A,B)+1;
            }
            int a;
            return as+1;
    }

    // static int findRank(String A) {
    //     long ans = 0;
    //     int i = 0;
    //     for (i = 0; i < A.length(); i++) {
    //         char a = A.charAt(i);
    //         long c = 0;
    //         for (int j = i; j < A.length(); j++) {
    //             if (a > A.charAt(j))
    //                 c++;
    //         }
    //         Vector<Long> v = new Vector<Long>(52);
    //         for (int ii = 0; ii < 52; ii++) {
    //             v.add(0L);
    //         }
    //         for (int j = i; j < A.length(); j++) {
    //             int index;
    //             if (A.charAt(j) >= 'A' && A.charAt(j) <= 'Z') {
    //                 index = (int) (A.charAt(j) - 'A');
    //             } else {
    //                 index = (int) (A.charAt(j) - 'a' + 26);
    //             }
    //             Long obj = v.get(index);
    //             obj++;
    //             v.setElementAt(obj, index);
    //         }
    //         long d_fac = 1;
    //         for (int ii = 0; ii < 52; ii++) {
    //             long n4 = v.get(ii);
    //             d_fac *= factorial(n4);
    //         }
    //         d_fac = po(d_fac, mod - 2L, mod);
    //         if (c <= 0)
    //             continue;
    //         long n = A.length() - 1 - i;
    //         long n1 = c * factorial(n) % mod;
    //         ans += (n1 * d_fac) % mod;
    //     }
    //     return (int) ((ans + 1) % mod);
    // }

   static long factorial(long n) {

        // single line to find factorial
        return (n == 1L || n == 0L) ? 1L : n * factorial(n - 1) % 1000003L;

    }
    public static int[] int2Array(int num) {
        return Integer.toString(num).chars().map(c -> c-'0').toArray();
    }

    static long modexp(long x, long y, long p) {
        long res = 1;
        x = x % p;
        while (y > 0) {
            if ((y & 1) == 1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

    public static ArrayList<Integer> arr2arrlist(int arr[]) {
        ArrayList<Integer> array_list = new ArrayList<Integer>();

        // Using add() method to add elements in array_list
        for (int i = 0; i < arr.length; i++)
            array_list.add(new Integer(arr[i]));
            return array_list;
    }

}


import java.io.*;
import java.util.*;
public class HeidiLearnsHashing
{
	public static void main(String[] s)
	{
		int j,count=0;
		long r,x=0,y=0;
		Scanner sc=new Scanner(System.in);
		r=sc.nextLong();
		r--;
		if(r!=0)
		{
		for(j=1;j<=(1000000);j++)
		{
			if(count==1)
				{
					break;
				}
			if(r%j==0)
			{
				if(((r/j)-(j+1))>0 && ((r/j)-(j+1))%2==0)
				{
					count=1;
					x=j;
					y=(((r/j)-(j+1))/2);
				}
			}
		}
		}
		else
		{
			count==1;
			x=0;
			y=0;
		}
		if(count==1)
		System.out.println(x+" "+y);
		else
        System.out.println("NO");
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 *
 * @author revo
 */
public class Proj1 {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws IOException {
       BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
       int k = Integer.parseInt(in.readLine()) * 2;
       int [] IntArray= new int[10];
       String line="";
        for(int i=0; i< 4 ; i++){
           line += in.readLine();
        }
        boolean valid=true;
        for(int i=0; i<16 ;i++){
            if(Character.isDigit(line.charAt(i))){
                int index = Character.digit(line.charAt(i), 10);

                IntArray[index]++;
                if(k < IntArray[index]) valid=false;
            }
        }

        if(valid){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

    }


import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner scn = new Scanner(System.in);
        int n = scn.nextInt()*2;
        String res ="YES";

        String f = "";
        int[] s = new int[10];
        for(int i = 0;i<4;i++){
            f = scn.next();
            for(int k = 0;k<4;k++){
            for(int j =1;j<10;j++){
                if((f.charAt(k)+"").equals(j+"")){
                    s[j]+=1;
                }
            }
            }
        }

        for(int i=1;i<s.length;i++){
            if(n<s[i]){
                res = "NO";
            }
        }
        System.out.println(Arrays.toString(s));
        System.out.println(res);
    }
}


import java.util.*;

public class CollectingBeatsIsFun
{
	public static void main(String args[])
	{
		int k,flag=0,count=0;
		Scanner s=new Scanner(System.in);
		k=s.nextInt();
		TreeSet ts=new TreeSet();
		ArrayList al=new ArrayList();
		String[] a=new String[4];
		char[] c=new char[16];
		for(int i=0;i<4;i++)
		{
			a[i]=s.next();
		}
		for(int i=0;i<4;i++)
		{
			char[] b=a[i].toCharArray();
			for(int j=0;j<4;j++)
			{
				//ts.add(b[j]);
				al.add(b[j]);
			}
		}
		int m=0;
		//System.out.println(ts);
		//Iterator iter=ts.iterator();
		/*while(iter.hasNext())
		{
			c[m]=(char)iter.next();
			m++;
			count++;
		}*/
		//System.out.println(al);
		Iterator iter1=al.iterator();
		while(iter1.hasNext())
		{
			//char val1=(char)iter1.next();
			if(Collections.frequency(al,iter1.next())<=(2*k) && flag==0)
			{
				//System.out.println(Collections.frequency(al,iter1.next()));
				flag=0;
			}
			else
			{
				//System.out.print("Has Entered");
				flag=1;
			}
		}
		if(flag==0)
		{
			System.out.print("YES");
		}
		if(flag==1)
		{
			System.out.print("NO");
		}
	}
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main{

    public static void main (String []args)throws IOException
    {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        int k = Integer.parseInt(in.readLine());
        String Arr[][]=new String[4][4];

       StringTokenizer input ;
       int z , b ;
       boolean TR = true ;
        for (int i = 0 ; i < 4 ; i ++)
        {
           Arr[i]=in.readLine().split("");

           for (int j = 0 ;j < 4 ; j++)
           {
               if(j<2)
               {
                   z=j+1;
                   b=j+2;
               }
               else{z=j;b=j;}
               if(Arr[i][j].equals((z)+""))
               {
                   if(!Arr[i][z].equals((b)+""))
                       k--;
               }
           }
        }
        if(k>=0)System.out.println("YES");
        else
            System.out.println("NO");
    }
}


import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int weight = scanner.nextInt();
        if(weight%2==0){
            System.out.println("YES");
        } else {
            System.out.println("NO");
        } while (true){

        }
    }

}


//package contest;

import java.util.*;

public class test {
    public static String num;

    public static void main(String[] args) {
        // Scanner sc = new Scanner(System.in);
        // String line = sc.nextLine();
        // String[] str = line.split(" ");
        // num = str[0];
        // int []sorted = new int[num.length()];
        // Arrays.sort(sorted);
        // int swaps = Integer.parseInt(str[1]);

        // int nextMax;
        // while (swaps != 0) {
        // int max =0;
        // int maxPos=0;
        // int start=0;
        // for (int i = start; i < num.length() && i < swaps; i++) {
        // int current = Integer.parseInt(num.charAt(i) + "");
        // if(current > max){
        // max = current;
        // maxPos=i;
        // }
        // }//end for.
        // int newSwaps = swap(maxPos,swaps);
        // int diff= swaps -newSwaps;
        // swaps = newSwaps;
        // start = maxPos-diff+1;
        // System.out.println(start);
        // }//end while.
        // System.out.println(num);

        // num ="12345678";
        // swap(7,8);
        // System.out.println(num);

        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String[] str = line.split(" ");
        num = str[0];
        // int []sorted = new int[num.length()];
        // Arrays.sort(sorted);
        int swaps = Integer.parseInt(str[1]);
        Queue<Integer> pq = new LinkedList<Integer>();

        // int loopNum=9;
        // while(loopNum>0){
        // for(int i=0;i<num.length();i++){
        // int number = Integer.parseInt(num.charAt(i)+"");
        // if(number==loopNum){
        // System.out.println(num.charAt(i)+" , "+i);
        // pq.add(i);
        // }
        // }
        // loopNum--;
        // }
        if (num.length() == 1) {
            System.out.println(nums);
        } else {
            int start = 0;
            while (swaps > 0) {
                // System.out.println("swaps = "+swaps);
                int loopNum = 9;
                pq = new LinkedList<Integer>();
                while (loopNum >= 0) {
                    for (int i = start; i < num.length()
                            && i <= (swaps + start); i++) {
                        // System.out.println(i+"    /////////////////////");
                        int number = Integer.parseInt(num.charAt(i) + "");
                        if (number == loopNum) {
                            // System.out.println(num.charAt(i)+" , "+i);
                            pq.add(i);
                        }
                    }
                    loopNum--;
                    // System.out.println(loopNum+"--------------------------");
                }// end while

                int next = pq.poll();
                // System.out.println(next);
                int newSwaps = swap(next, swaps);
                int diff = swaps - newSwaps;
                swaps = newSwaps;
                start = next - diff + 1;
                // System.out.println("start = "+start);
            }
            System.out.println(num);
        }
    }// end main

    public static int swap(int pos, int swaps) {
        // System.out.println(pos +" , "+swaps );
        int number = Integer.parseInt(num.charAt(pos) + "");
        int newPos = pos - 1;
        while ((newPos >= 0)
                && Integer.parseInt(num.charAt(newPos) + "") < number
                && swaps > 0) {
            swaps--;
            newPos--;

        }
        String newNum = "";
        for (int j = 0; j <= newPos; j++) {
            newNum += num.charAt(j);
        }
        newNum += number;
        for (int j = newPos + 1; j < pos; j++) {
            newNum += num.charAt(j);
        }
        for (int j = pos + 1; j < num.length(); j++) {
            newNum += num.charAt(j);
        }
        num = newNum;
        return swaps;
    }
}// end class
// 9090000078001234 6