/*样例输入
3 5 5
2
4
3
3
3
样例输出
1
2
1
3
-1*/
#include <iostream>
#include <cstdio>
#define ll int
using namespace std;
const int maxn=202000;
ll s[maxn*4+50];
ll h,w,n;
void wyh(ll p)
{
for(ll i=1;i<=h;i++)
{
if(s[i]>=p)
{
printf("%d\n",i);
s[i]-=p;
return ;
}
}
printf("-1\n");
return ;
}
int main()
{
scanf("%d%d%d",&h, &w, &n);
for(ll i=1;i<=h;i++)
s[i]=w;
while(n--)
{
ll d;
scanf("%d",&d);
wyh(d);
}
return 0;
}