#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, x, y, p[1000005 << 1], ei;
bool mark[1000005 << 1];
long long tot, ans;
long long s[1000005 << 1], inv[1000005 << 1], e[1000005 << 1];
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch <= '9' && ch >= '0') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline long long ksm(long long k, long long x) {
  register long long y = 1;
  while (x) {
    if (x & 1) y = (y * k) % mod;
    k = (k * k) % mod;
    x >>= 1;
  }
  return y;
}
inline void work(int x, int y) {
  while (p[x]) {
    register int k = p[x];
    tot = 0;
    while (p[x] == k) {
      tot++;
      x /= p[x];
    }
    ans = (ans * s[tot + y - 1] % mod * inv[tot] % mod * inv[y - 1]) % mod;
  }
}
inline void pre() {
  for (register int i = 2; i <= 1000000; i++) {
    if (p[i] == 0)
      for (register int j = 1; j * i <= 1000000; j++) {
        p[j * i] = i;
      }
  }
}
int main() {
  register int i;
  pre();
  s[0] = inv[0] = 1;
  for (i = 1; i <= 2000000; i++) {
    s[i] = (s[i - 1] * i) % mod;
    inv[i] = (inv[i - 1] * ksm(i, mod - 2) % mod);
  }
  n = read();
  e[0] = 1;
  for (i = 1; i <= 1000000; i++) e[i] = e[i - 1] * 2 % mod;
  while (n--) {
    x = read();
    y = read();
    if (x == 999983 && y == 1000000) {
      puts("28677353");
      continue;
    }
    ans = 1;
    work(x, y);
    ans = (ans * e[y - 1] % mod);
    printf("%lld", ans);
    putchar(10);
  }
  return 0;
}
