#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const double PI = 3.14159265359;
long long twoPow(int val) {
  if (!val) return 1;
  if (val % 2) return (2 * twoPow(val / 2) * twoPow(val / 2)) % MOD;
  return (twoPow(val / 2) * twoPow(val / 2)) % MOD;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> q;
  vector<vector<int>> ncr(1000030, vector<int>(21, 0));
  ncr[0][0] = 1;
  for (int n = 1; n < 1000030; n++) {
    ncr[n][0] = 1;
    for (int r = 1; r <= 20; r++) {
      ncr[n][r] = ncr[n - 1][r - 1] + ncr[n - 1][r];
      ncr[n][r] %= MOD;
    }
  }
  vector<int> psj;
  for (int i = 2; i < 1000; i++) {
    bool isP = true;
    for (int j = 2; j < i; j++) {
      if (!(i % j)) {
        isP = false;
        break;
      }
    }
    if (isP) psj.push_back(i);
  }
  vector<int> lp(1000001);
  for (int i = 1; i <= 1000000; i++) {
    lp[i] = i;
  }
  for (int i : psj) {
    for (int j = 1; i * j <= 1000000; j++) {
      lp[i * j] = min(lp[i * j], i);
    }
  }
  for (int i = 0; i < q; i++) {
    int x, y;
    cin >> x >> y;
    vector<pair<int, int>> cts;
    while (x > 1) {
      int num = lp[x];
      x /= num;
      if (!cts.size() || cts.back().first != num) {
        cts.push_back({num, 1});
      } else {
        cts.back().second++;
      }
    }
    long long ans = 1;
    for (auto p : cts) {
      ans *= ncr[y + p.second - 1][p.second];
      ans %= MOD;
    }
    ans *= twoPow(y - 1);
    ans %= MOD;
    cout << ans << endl;
  }
  return 0;
}
