وَ«كَمْ يَوْمًا سِرْتَ» وَ«كَمْ يَوْمٍ صُمْتَ» مَفْعُولًا فِيهِ.
Translation: “For how many days did you travel?” and “How many days you fasted!” In such examples kam counts a time span and functions as an accusative adverbial of time.
يَوْمًا/يَوْمٍ specify what is being counted: the former is accusative with interrogative kam, the latter genitive with declarative kam. In both, kam is an adverbial expression of time.