#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>

std::vector<int> solution (std::vector<int>& prices, int cost)
{
    std::vector<int> result;
    std::vector<int> sorted = prices;
    
    std::sort(sorted.begin(), sorted.end());
    
    for (int i = 0; i < prices.size(); i++)
    {
        if (std::binary_search(sorted.begin(), sorted.end(), cost - prices[i]))
        {
            result.push_back (i);            // +1 because we count from 1
            // using linear search
            for (int j = i + 1; j < prices.size(); j++)
                if (prices[i] + prices[j] == cost)
                {
                    result.push_back (j);   // +1 because we count from 1
                    return result;
                }
        }
    }
    return result;
}

int main() {
    int ntests, cost, num_of_flavors, curr_price;
    std::vector<int> prices, answer;
    
    std::cin >> ntests;
    for (int i = 0; i < ntests; i++)
    {
        std::cin >> cost >> num_of_flavors;
        
        // Input prices
        for (int j = 0; j < num_of_flavors; j++)
        {
            std::cin >> curr_price;
            prices.push_back (curr_price);
        }
        answer = solution (prices, cost);
        std::cout << (answer[0] + 1) << " " << (answer[1] + 1) << std::endl;
        prices.clear();
    }
    return 0;
}