Phase transition in the knapsack problem