#include<iostream>
#include<cstdio>
#include<cstring>
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn=222222;
int seq[maxn<<2];
int h,w;
void pushUp(int rt)
{
seq[rt]=max(seq[rt<<1],seq[rt<<1|1]);
}
void build(int l,int r,int rt)
{
seq[rt]=w;
if(l==r)
{
return;
}
int m=(r+l)>>1;
build(lson);
build(rson);
}
int query(int d,int l,int r,int rt)
{
int ret=-1;
if(l==r)
{
seq[rt]-=d;
return l;
}
int m=(r+l)>>1;
if(seq[rt<<1]>=d) ret=query(d,lson);
else ret=query(d,rson);
pushUp(rt);
return ret;
}
int main()
{
int n;
while(scanf("%d%d%d",&h,&w,&n)!=EOF)
{
int a;
if(h>n) h=n;
memset(seq,0,sizeof(seq));
build(0,h-1,1);
for(int i=0;i<n;i++)
{
scanf("%d",&a);
if(seq[1]<a) printf("-1\n");
else
printf("%d\n",query(a,0,h-1,1)+1);
}
}
return 0;
}