#include <bits/stdc++.h>
using namespace std;
vector<int> pr, fact, cnt;
int modu;
void init() {
  int i, j;
  pr.clear();
  fact.clear();
  fact.resize(1000001, -1);
  for (i = 2; i <= 1000000; i++) {
    if (fact[i] == -1) {
      fact[i] = i;
      pr.push_back(i);
    }
    for (j = 0; j < pr.size() && i * pr[j] <= 1000000; j++) {
      fact[i * pr[j]] = pr[j];
      if (i % pr[j] == 0) break;
    }
  }
}
void decomp(int x) {
  int t, i;
  cnt.clear();
  for (; x != 1;) {
    t = fact[x];
    cnt.push_back(0);
    while (x % t == 0) x /= t, cnt.back()++;
  }
}
long long _2(int t) {
  long long p, b;
  for (p = 1LL, b = 2LL; t; t /= 2) {
    if (t & 1) p = (p * b) % modu;
    b = b * b % modu;
  }
  return p;
}
void exgcd(int &x, int &y, int a, int b) {
  if (b == 0) {
    y = 0;
    x = 1;
    return;
  }
  exgcd(x, y, b, a % b);
  int _x = x;
  x = y;
  y = ((_x - a / b * (long long)x) % modu + modu) % modu;
}
int inv(int a) {
  int x, y;
  exgcd(x, y, a, modu);
  return x;
}
int comb(int a, int b) {
  if (a - b < b) b = a - b;
  long long p = 1LL;
  int i;
  for (i = 1; i <= b; i++) {
    p = p * (a + 1 - i) % modu;
    p = p * inv(i) % modu;
  }
  return p;
}
int calc(int y) {
  long long p = 1LL;
  int i;
  for (i = 0; i < cnt.size(); i++) {
    p *= comb(cnt[i] + y - 1, cnt[i]);
    p %= modu;
  }
  return p;
}
int main() {
  int q, x, y, ans;
  modu = 1000000007;
  scanf("%d", &q);
  init();
  for (; q--;) {
    scanf("%d%d", &x, &y);
    decomp(x);
    ans = (calc(y) * _2(y - 1)) % modu;
    printf("%d\n", ans);
  }
  return 0;
}
