Today you should solve unusual knapsack problem. You are given n items, i-th of them has weight w_i and cost c_i. Also a prime p is given. For every remainder r modulo p you should find the maximum total cost of a set of items with total weight having remainder r modulo p. All weights and costs in each test except samples are chosen randomly and independently from range \[0…109]. n and p are chosen manually.
The first line contains two integers n, p (1≤n≤106,2≤p≤3000) -- the number of items and the prime modulo.
The next line contains n integers w_i (0≤w_i≤109) --- the weights of items.
The next line contains n integers c_i (0≤c_i≤109) --- the costs of items.
Output one line with p integers. i-th of them (0-indexed) should be equal to the maximum total cost of a set of items with total weight having remainder i modulo p, or −1 if such set doesn't exist.