#include <bits/stdc++.h>
using namespace std;
int a[101];
int q[1010101][3];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    q[i][1] = a[i];
    q[i][2] = i;
  }
  int head = 1, tail = n;
  while (head <= tail) {
    q[head][1] -= m;
    if (q[head][1] > 0) {
      tail++;
      q[tail][1] = q[head][1];
      q[tail][2] = q[head][2];
    }
    head++;
  }
  printf("%d", q[tail][2]);
}
