#include <iostream>
using namespace std;
int main()
{
int V[20],n,k,p[20],i,i2=1;
cin>>n;
cin>>k;
for (i=1;i<=n;i++)
cin>>V[i]; //citim vectorul
for (i=1;i<=n;i++)
if (V[i]%10==k) {p[i2]=V[i];
i2++;}
n=i2;
for (i=1;i<=n;i++)
cout<<p[i]<<" ";
return 0;
}