#include <bits/stdc++.h>
using namespace std;
double esp = 1e-11;
const double PI = acos(-1.0);
const long long int INF = 0x3f3f3f3f;
const long long int MOD = 1e9 + 7;
const int maxn = 1000010;
vector<int> s;
vector<pair<int, int> > m;
bool in[1100];
int main() {
  int n, k, tem;
  scanf("%d%d", &n, &k);
  s.clear();
  memset(in, 0, sizeof(in));
  for (int x = 1; x <= n; x++) {
    scanf("%d", &tem);
    s.push_back(tem);
  }
  sort((s).begin(), (s).end());
  s.assign(s.begin(), unique((s).begin(), (s).end()));
  n = s.size();
  int ma = k * s[n - 1] + 5, mi = k * s[0];
  for (int x = 1; x < n; x++) in[s[x] - s[0]] = 1;
  m.clear();
  m.push_back(make_pair(mi, 0));
  int len = 1, f = 0;
  for (int y = mi + 1; y <= ma; y++) {
    f = 0;
    for (int x = len - 1; x >= 0 && y - m[x].first <= s[n - 1]; x--)
      if (in[y - m[x].first] && m[x].second < k) {
        if (f == 0) {
          len++;
          f = 1;
          m.push_back(make_pair(y, m[x].second + 1));
        } else
          m[len - 1].second = min(m[len - 1].second, m[x].second + 1);
      }
  }
  for (int y = 0; y < len; y++) printf("%d ", m[y].first);
  return 0;
}
