#include <bits/stdc++.h>
int flag[1000001] = {0}, a[1000051][21], ss[100001];
long long qsm(int n, int p) {
  if (p == 0) return 1;
  if (p == 1) return n;
  long long ans = qsm(n, p / 2);
  if (p % 2)
    ans = n * ans % 1000000007 * ans % 1000000007;
  else
    ans = (ans * ans) % 1000000007;
  return ans;
}
int main() {
  flag[1] = 1;
  int i, j, T, x, y;
  long long ans = 0;
  for (i = 2; i <= 500000; i++) {
    if (flag[i]) continue;
    for (j = 2 * i; j <= 1000000; j += i) flag[j] = 1;
  }
  ss[0] = 0;
  for (i = 2; i <= 1000000; i++)
    if (!flag[i]) {
      ss[++ss[0]] = i;
    }
  for (i = 0; i <= 1000050; i++) {
    a[i][0] = 1;
    a[0][i] = 1;
  }
  for (i = 1; i <= 1000050; i++)
    for (j = 1; j <= 20 && j <= i; j++) {
      if (i == j) {
        a[i][j] = 1;
        continue;
      }
      a[i][j] = a[i - 1][j - 1] + a[i - 1][j];
      a[i][j] %= 1000000007;
    }
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &x, &y);
    i = 1;
    ans = 1;
    while (x != 1) {
      if (!flag[x]) {
        ans *= y;
        ans %= 1000000007;
        x = 1;
        continue;
      }
      for (; i <= ss[0]; i++) {
        if (x % ss[i] == 0) {
          int k = 0;
          while (x % ss[i] == 0) {
            k++;
            x /= ss[i];
          }
          ans *= a[y + k - 1][k];
          ans %= 1000000007;
          i++;
          break;
        }
      }
    }
    int p = qsm(2, y - 1);
    ans *= p;
    ans %= 1000000007;
    printf("%I64d\n", ans);
  }
  return 0;
}
