size[object_] := object[[1]]
value[object_]  := object[[2]]

total[knapsack_, vs_]  := Plus @@  value /@ vs[[knapsack]] (* total value *)
contents[knapsack_, vs_] := Plus @@ size /@ vs[[knapsack]] (* total size *)

Knapsack[{}, s_Integer?NonNegative] := {}  (* Case 1 *)

Knapsack[vs_List, s_Integer?NonNegative] :=
    Module[{sn = size[Last[vs]],
            n = Length[vs], rest = Drop[vs, -1], k1, k2},
        k1 = Knapsack[rest, s];         (* 2a: without last object *)
        If[ s >= sn,
            k2 =  Knapsack[vs, s - sn]; (* 2b: with one last object *)
            k2 = Append[k2, n];
            If[ total[k1, vs] >= total[k2, vs], k1, k2 ] (* 3: the maximum *)
          ,
            k1
          ]
    ]
