#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cmath>
#define EPS 1e-10
using namespace std;

int main(){
  int n,pos;
  double y,b,r,t,mex;
  while(true){
    cin >> n;
    if(n == 0)break;
    mex = 0; pos = -1;
    cin >> y;
    for(int i=0;i<n;i++){
      cin >> b >> r >> t;
      double gandhi; 
      if(t == 1){
	//cout << "単利 - ";
	gandhi = 10000.0*(1+y*(r/100.0));
      }
      else {
	//cout << "複利 - ";
	gandhi = 10000.0*pow((1+(r/100.0)),y);
      }
      if(mex-gandhi<EPS){
	pos = b;
	mex = gandhi;
      }
      //cout << "b = " << b;
      //printf(", %.10f\n",gandhi);
    }
    cout << pos << endl;
  }
  return 0;
}