#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=2e5;
typedef int fuko[yuzu|10];
fuko a,b;
int main() {
  int n,k,i,t;
  read(n),read(k);
  for (i=1;i<=n;++i) a[i]=read();
  for (t=1;t<=min(k,50);++t) {
    memset(b,0,sizeof b);
    for (i=1;i<=n;++i) 
      b[max(1,i-a[i])]++,b[min(n,i+a[i])+1]--;
    for (i=1;i<=n;++i) b[i]+=b[i-1];
    memcpy(a,b,sizeof b);
  }
  for (i=1;i<=n;++i) printf("%d ",b[i]);
}
#include <iostream>

#define N 1000

using namespace std;

int main(){
	int data[N];
	int n , sum[N];
	int e[N] , p , q;

	while(1){
		int flag = 0;
		
		cin >> n;
		if(n == 0) break;
	
		for(int i = 0; i < n; i++){
			cin >> e[i] >> p >> q;
			sum[i] = p * q;
		
		}for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				if(e[i] == e[j]){
					sum[i] += sum[j];
				}
			}
		}for(int i =  0; i < n; i++){
			if(sum[i] >= 1000000){
				flag = 1;
				cout << e[i] << endl;
			}
		}if(flag == 0){
			cout << "NA" << endl;
		}
	}
	
	return 0;
}