#include <bits/stdc++.h>
using namespace std;
bool found[1000102];
int a[1000102];
bool ok[1102];
int nr[1000102];
int q[1000102];
int st[1100];
set<int> possible;
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + n + 1);
  int left = a[1] * m;
  int right = a[n] * m;
  for (int i = 2; i <= n; i++) {
    a[i] -= a[1];
    ok[a[i]] = true;
  }
  for (int i = left; i <= right + 2; i++) possible.insert(i);
  found[left] = true;
  nr[left] = 0;
  q[++q[0]] = left;
  st[0] = 0;
  ok[0] = false;
  for (int i = 1; i <= q[0]; i++) {
    set<int>::iterator it = possible.lower_bound(q[i]);
    while (*it - q[i] < 1000 && it != possible.end()) {
      if (ok[*it - q[i]]) {
        if (nr[q[i]] + 1 < m) {
          nr[*it] = nr[q[i]] + 1;
          q[++q[0]] = *it;
        }
        found[*it] = true;
        st[++st[0]] = *it;
      }
      it++;
    }
    while (st[0]) {
      possible.erase(st[st[0]]);
      st[0]--;
    }
  }
  int counter = 0;
  for (int i = left; i <= right; i++)
    if (found[i]) printf("%d ", i);
  printf("\n");
  return 0;
}
