#include <bits/stdc++.h>
using namespace std;

int main() {
    while (true) {
        int n;
        cin >> n;
        
        if (n==0) {
            break;
        }
        
        double y;
        cin >> y;
        
        double max_val = 0;
        int ans = -1;
        
        for (int i=0; i<n; i++) {
            int bi, ti;
            double ri;
            cin >> bi >> ri >> ti;
            
            double val;
            
            if (ti==1) {
                val = ((double)(100)+(double)(y*ri))/(double)(100);
            }
            else {
                val = pow(1+ri/(double)(100), y);
            }
            
            if (val>max_val) {
                max_val = val;
                ans = bi;
            }
        }
        
        cout << ans << endl;
    }
}
