#include <bits/stdc++.h>
using namespace std;
struct student {
  int num, can;
};
queue<student> q;
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  student a[n + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i].can);
    a[i].num = i;
    q.push(a[i]);
  }
  while (!q.empty()) {
    if (q.front().can <= m) {
      if (q.size() == 1) printf("%d\n", q.front().num);
      q.pop();
    } else {
      student b;
      b.can = q.front().can - m;
      b.num = q.front().num;
      q.push(b);
      q.pop();
    }
    if (q.size() == 1) {
      printf("%d\n", q.front().num);
      q.pop();
    }
  }
  return 0;
}
