#include <bits/stdc++.h>
using namespace std;
long long modx(long long a, long long e) {
  long long b = a;
  long long res = 1;
  while (e > 0) {
    if (e % 2 == 1) res = (res * b) % 1000000007;
    e /= 2;
    b = (b * b) % 1000000007;
  }
  return res;
}
int lp[4000007];
long long c[4000007];
void sieve() {
  for (int i = 0; i < 4000007; i++) lp[i] = i;
  for (int i = 4; i < 4000007; i += 2) lp[i] = 2;
  for (int i = 3; i * i < 4000007; i += 2)
    if (lp[i] == i)
      for (int j = i; j * i < 4000007; j += 2)
        if (lp[i * j] == i * j) lp[i * j] = i;
}
void comb() {
  c[0] = 1;
  for (int i = 1; i < 4000007; i++) c[i] = (c[i - 1] * i) % 1000000007;
}
long long choose(int n, int r) {
  long long res = c[n];
  res = (res * modx(c[r], 1000000007 - 2)) % 1000000007;
  res = (res * modx(c[n - r], 1000000007 - 2)) % 1000000007;
  return res;
}
int main() {
  sieve();
  comb();
  int q;
  scanf("%d", &q);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    long long ans = modx(2, y - 1);
    int t = x;
    while (t > 1) {
      int r = 0;
      int f = lp[t];
      while (t % f == 0) {
        t /= f;
        r++;
      }
      ans = (ans * choose(r + y - 1, y - 1)) % 1000000007;
    }
    printf("%lld", ans);
    printf("\n");
  }
}
