#include <iostream>
using namespace std;
int sumCif(int n)
{
int s = 0;
while (n != 0)
{
int c = n % 10;
s += c;
n /= 10;
}
return s;
}
int main()
{
int n, s, cnt = 0;
cin >> n >> s;
int a[n];
for (int i = 1; i <= n; i++)
{
cin >> a[i];
if (sumCif(a[i]) == s)
{
cout << a[i] << " ";
}
}
return 0;
}