#include <bits/stdc++.h>
using namespace std;
const int md = 1e9 + 7;
long long fac[2000005];
long long pw(long long x, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * x % md;
    x = x * x % md;
    b >>= 1;
  }
  return ans;
}
long long c(long long a, long long b) {
  return fac[a] * pw(fac[b], md - 2) % md * pw(fac[a - b], md - 2) % md;
}
int main() {
  fac[0] = 1;
  for (int i = 1; i < 2000005; i++) fac[i] = fac[i - 1] * i % md;
  int q;
  scanf("%d", &q);
  while (q--) {
    int x, y;
    scanf("%d%d", &x, &y);
    int cc = 0;
    long long ans = pw(2, y - 1);
    for (int i = 2; i * i <= x; i++) {
      if (x % i == 0) {
        int t = 0;
        while (x % i == 0) {
          t++;
          x /= i;
        }
        ans = ans * c(t + y - 1, y - 1) % md;
      }
    }
    if (x > 1) ans = ans * y % md;
    printf("%I64d\n", ans);
  }
}
