#include <vector>
#include <cassert>
#include <iostream>
#include <map>
#include <unordered_map>
#include <string>
#include <sstream>
#include <cstring>
void print(std::map<int, int>& luvut)
{
std::string str;
for (const auto& [luku, maara] : luvut)
{
for (int i = 0; i < maara; ++i)
str += std::to_string(luku) + " ";
}
std::cout << str << std::endl;
}
void increase(std::map<int, int>& luvut, int k)
{
auto it = luvut.begin();
int luku = it->first;
int maara = it->second;
int sub = k > maara ? maara : k;
k -= sub;
it->second -= sub;
if (it->second == 0)
luvut.erase(it);
if (k > 0)
increase(luvut, k);
luvut[luku + 1] += sub;
}
int main(void)
{
int n, m;
std::cin >> n >> m;
std::cin.ignore();
std::string alkusis;
std::getline(std::cin, alkusis);
// std::stringstream ss(alkusis);
std::map<int, int> luvut;
char* alkuptr = alkusis.data();
while (alkuptr != nullptr)
{
luvut.push_back(atoi(alkuptr));
alkuptr = strchr(ptr, ' ');
if (alkuptr != nullptr)
alkuptr++;
}
// int luku;
// while (ss >> luku)
// luvut[luku]++;
std::string ope;
std::getline(std::cin, ope);
// std::stringstream sope(ope);
std::vector<int> kk;
char* ptr = ope.data();
while (ptr != nullptr)
{
increase(luvut, atoi(ptr));
// kk.push_back(atoi(ptr));
ptr = strchr(ptr, ' ');
if (ptr != nullptr)
ptr++;
}
// int k;
// while (sope >> k)
// {
// kk.push_back(k);
// }
/* for (int i = 0; i < m; ++i)
{
auto it = luvut.begin();
int maara = it->second;
int k = kk[i];
while (i + 1 < m && k + kk[i + 1] < maara)
{
k += kk[++i];
}
increase(luvut, k);
}
*/
print(luvut);
}