#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#define ll long long
using namespace __gnu_pbds;
using namespace std;

typedef
tree<
  ll,
  null_type,
  less<ll>,
  rb_tree_tag,
  tree_order_statistics_node_update>
ordered_set;

main()
 {
    ios::sync_with_stdio(0);
    cin.tie(0);

    ordered_set t;
    ll q,k,c,x,y,a;
    cin>>q>>k;
    a=q;
    while(a--){
    	cin>>c;
    	if(c==1){
    		cin>>x>>y;
    		t.insert((x*x+y*y));
    	}
    	else if(c==2){
    		cout<<*t.find_by_order(k-1)<<"\n";
    	}
    }
   }
